Editor event when laying a tile in a tilemap? (to prevent certain tiles on certain tilemaps)

So I have a grid with 4 child tilemaps. The two important ones are ‘Terrain’ and ‘Objects’.

I’d love to prevent object tiles from ever being placed on terrain and via versa. Or at the very least send a warning if I’m putting on the wrong map.

Anybody know how I could achieve this?

For anybody looking in the future:

In your start function, attach an event like so:

Tilemap.tilemapTileChanged += delegate(Tilemap tilemap, Tilemap.SyncTile[] tiles) {
            // Perform checks here
        };

Then add the [ExecuteInEditMode] attribute to the class.

Happy tiling :slight_smile:

1 Like