Switching tiles depending on condition

Hello all,

For a 2D top-down RPG game, I use Tiled as map editor and Tiled2Unity as importing tool.

What I want to achieve: All the map tiles should change their appearance according to the damage (condition) done to the tile. For instance, if you put an explosive on the ground, the ground tiles are supposed to change to those displaying the explosive damage on the ground (hole or whatever). Or you might want to have a burned ground tile in the case a fire breaks out.

The problem: Not only are almost all the map tiles supposed to change according to the interaction, but there are also a huge variety of different conditions (burned, hole, scratched, …). So the normal ground tile could easily be replaced by 20 differently looking tiles/sprites.

I don’t even know how to approach this. Do you have any suggestion for me? I’m new to Unity, so I might miss something basic to make this happen. Thank you!

You could do a script that has all the tile data you need in an array. For example you could use public Sprite[ ] tileSprites; Then, in the Inspector, you can just drag and drop the sprites you need into the array. As the tiles are effected by some event, you can change their appearance with; GetComponent().sprite = tileSprites[someindex].

Thanks, PGJ, this requires all the tiles to be separate GameObjects, right? Imported tile maps from the Tiled editor are meshes, meaning that the single tiles cannot be referenced to.

But considering the huge number of devs that work with Tiled and Tiled2Unity, there should be a way to do this…