Unity Tilemap Tips

In order to make my awesome JRPG I needed some sort of Tile System to create awesome maps. I have some code to load data from Tiled, however, Unity recently added their own system and doing it in the editor itself is much cleaner in my opinion than doing it in an external tool. However, apart from the Manual, there are not a lot of tutorials on how to use it and I found the manual pretty sparse.

The way I wanted to do it is the way I had previously set out with Tiled:

Essentially I wanted there to be 3 layers. Background, Middle and Foreground. However, the docs were not great in showing a way to do that, and inevitably you were not able to set a layer per tile like I had been doing in the past when loading from Tiled. So looking back at Tiled itself, I realised the layers were actually 3 tilemaps. The solution in Unity; create 3 Tilemap objects

 By creating 3 maps and then using the sorting layer to decide the draw order I could essentially have 3 layers like I did previously.

Similarly, as the player character only interacts with the middle layer, I only needed the physics object to be on the middle layer gameobject.

 

The last thing that did catch me out, and is a bit of a pain is having to go through is setting up if the tile is “Walkable” or not.

You essentially have to go to each individual tile asset and select the collider type. Which makes sense to be fair.

There are a load of awesome brushes as well you can grab from here:

https://github.com/Unity-Technologies/2d-extras

Which includes placing Prefabs and Animated Tiles. You do need to grab the Beta of Unity though which is less than ideal.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

Verify that you are not a robot! (If you are unlucky) *