Unity Development — Tilemap
When making 2D games and piecing your levels together, it can sometimes be difficult to work with what you have. Making sure all of your prefabs can come together to make something cohesive and proper designed for the player. There is a way, however, to streamline this task and make your level creations much simpler.
Introducing Unity’s Tilemap. This feature allows you to take mapped out sprites of anything and use it to paint your levels in a grid. In the Hierarchy, go to Create > 2D > Tilemap > Rectangular. This will give you a Grid, where you can place any number of Tilemaps.
Like sprites, these Tilemaps have sorting layers that you can adjust to have some appear in front of or behind others. This can help create a lot of depth in your scene.
Go to Window > 2D > Tile Palette to open the Tile Palette window. Here you can access different Tilemaps to paint on and change your palettes.
You may want to create a few new folders in your project. ‘Tilemap’ and inside there ‘Palettes’ and ‘Tiles’ to keep things organized. Click the palettes on the left and go down to Create New Palette. Name the new palette whatever you like and save it where somewhere appropriate. Now you can take sprites and drag them over to the Tile Palette window, with the proper palette open and it will save new tiles.
On the top of the window, you will see ‘Brush’, ‘Eraser’, and some extra tools to help you. From here is is fairly intuitive. Just click any tiles you want, or a group of tiles, and paint away in the Scene View.
Anything you don’t like, you can simply erase and start over. Remember to double check your Active Tilemap. You wouldn’t want to paint a whole section and have it be on the wrong layer.
Play around with layers, different tiles, and the other tools to see what new heights your level design can get to.