2D Mobile Game: Tilemaps


In this article, we are going to cover how to get started with using Tilemaps in Unity by creating a Tilemap, setting up a Tile Palette, importing tiles to the Tile Palette, and organizing all of this in our Project folder.

Getting Start with Tilemaps

The first thing we will need to do when getting started with Tilemaps is to open up the tile Palette window. This will give use access to the different individual tiles we upload, so we can insert them into our game.

Next, we are going to add a Tilemap to the game scene.

A grid is created with a child tilemap. There children objects are layers of tilemaps from background tilemaps to foreground. The first tilemap layer we are going to create is the Ground_Tilemap.

Since we are working on the Ground_Tilemap, that is the Active Tilemap, and we will want to create a new palette of tiles that we will use to create this ground layer.

This palette will be called “Ground Items” and it will be saved as a game object. In keeping things organized we will create a Sprites folder > Tilemap folder > Palettes folder, which we will save all of our tilemap palettes.

When importing a tilemap, make sure the Texture Type is Sprite (2D and UI) and Sprite Mode is Multiple. This will allow use to cut up the sprite into smaller tiles.

We are going to select Sprite Editor, which will open up a new window that will allow us to cut or slice this bring sprite image into smaller individual sprite tiles by selecting Slice, Type > Grid By Cell Size. The artist of this tilemap set informed us the Pixel Size is 64 by 64, so we are ready to click on Slice.

Make sure to click on Apply and you can see how the sprite has be sliced into individual tiles.

The Ground Sprite now has all of the individual tiles.

Remember, the artist told us the tiles are 64 by 64, so we will want to change all of the Ground tiles Pixels Per Unit to the same ratio of 64. Make sure to select Apply to make the change.

Lets add these tiles to our Tile Palette by clicking and dragging the Ground set to the Tile Palette window.

It is going to save each of the tiles as individual assets and to stay organize, we are going to create a Tiles folder in our Tilemap folder and save all of this individual tiles into a Ground folder.

Now in our Project window, we can see how the Palette was saved alonng with the Ground tiles.

Now the Palette with the individual tiles are ready to be used to paint the game scene.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store