Interact with tile / triggering script


I am trying to understand unitys tile system and currently thinking about a solution to bring the user the possibility to place objects on an isometric map. The user is placing them on is own, so there are two problems for me, which needs to be solved. The object should be in the correct rendering order in the correct tile map, which is no problem so far, because I place a tile and no Object at the moment. But it also should be interactable via OnMouseDown(). If he is for example placing a chest he should be able to open it immediately.

So to get this trigger on this tile, it was my idea to instantiate a 2D collider to the exact position of it. Both - the position of the tile and the position of the collider and script component would be saved in a List, so that they could be loaded again after the game has been quited.

Is this a good way to go or would you recommend to modify a GameObject brush tool, so that the layer is correct? For me the problem is to combine the interactability and the correct rendering layer with the point that the player should be able to place things on the map.

Thank you for helping!
Kind regards


Ok, I have found a solution and I am able to place fine rendered Objects in an isometric world in runtime and interact with them.

  • First of all you need to setup the 2D - extra pack to use GameObject brushes.

  • Set up a GameObject brush like explained here.

  • Than you can place the GameObject by let the user paint it on the tilemap by using

    brush.Paint(grid, tilemap.gameObject, vector3IntCellLocation);

“Where grid is the Tilemap Grid,
tilemap is the Tilemap, and
vector3IntCellLocation is the location
to paint in Cell coordinates. You can
use grid.WorldToCell(Vector3 position)
to get the Cell coordinate.”

  • Now just put a box collider and a simple script with a OnMouseDown() function on the GameObject which you would like to brush into the game