Tilemaps best practices

Hello everyone, I’m pretty new to Unity and I just finished some courses and tutorial found in the official documentation and I’m now in the process to apply what I learned so far using different assets from the ones provided with the tutorial, to see if I understood all the material.

I’m trying to build a simple top-down game with some free asset I found online.
My tile palette is composed, among others, of tiles like these:
6761617--780811--green.png 6761617--780808--fence.png 6761617--780805--house.png

In order to have something like this:

6761617--780820--toghether.png (sorry for the quality, I recreated it in gimp since I’m not on the computer where I have Unity now)

I had to create three Tilemaps under the same Grid. The botton tilemap containing the grass (sort order -2), the middle one containing the fence (sort order -1) and the top one containing the house (sort order 0).
My first question is: given the tileset I have, is this the most efficient way to obtain what I needed?

After having solved this problem I wanted to add a collider to the fence and to the house, but since now they are on two different tilemaps I cannot use a composite collider to optimize the collider’s layout. Is there another way to do this in a more efficient way?
Instead of using tiles for “interactable objects”, should I use “proper” game objects instead?

Thank you

Hi, this would depend on how you want other Renderers to interact and sort against each other in your Scene (eg. do characters work in between or behind the fence and the house?), as well as how you want to set Tiles in your Tilemaps (eg. in different layers or in one Tilemap).

Colliders can be composited under one CompositeCollider2D provided that the CompositeCollider2D is in same or in a parent GameObject of the other Collider components.

This would depend on how interactable your objects would be. Tiles on a Tilemap rely on the various Tilemap components, and may not be as flexible as a separate GameObject, but could be good enough for simple use-cases.

1 Like

Thank you very much.