Mobile Games In Unity — Intro To Tilemaps
In this article I’ll be going over Tilemaps and how to use them.
Here is a blank scene with the Tile Palette window on the top left. I like to set my scenes up like this when working with Tile Palettes. The tile palette window will basically house all of the 2D art assets you import into your project. I’ve already imported some different tile maps, but I’ll go over how to create a palette.
To create a palette, all you need to do is click the drop down menu where mine says “Ground Items” and click “Create new Palette”. Unity will then prompt you to save this palette. Save it in your location of choice. After that you’ll be able to add things to this palette.
In my project I already have some things imported.
I need to cut this image up so that I can use pieces of it to create the level.
In the sprite editor cut them by cell size then drag all the images into the palette. You’ll be prompted to save this as well. Save it in another folder called “Tiles”. Once you do that you’ll see the images populate inside the palette window.
Now you can paint the level. We need a grid. So Create a new game object. Go to 2D > Tilemap and call the child object to the grid “Ground”. THis will be the ground layer.
Make sure the active tilemap is the ground layer.
Now you can paint the level. I’ll create a simple ground layer.
You can see whatever the white rectangle in the scene view surrounds in the game view. There is a lot to dig into when it comes to making an entire level. Several layers can be created giving the level a feeling of depth and a sense of parallax can even be implemented using the layers in Unity. I’ll dig more into this topic in the next few articles. This has been a simple intro to tilemaps in Unity.