- Home /
Getting cell position of a Tile from a reference to that Tile at runtime
I am working on a project where the world is tile-based. At runtime, some tiles get populated by generic characters, with many instances of the same character.
To make things simpler for me to place/edit the characters visually, I created a class CharacterTile, inherting from Tile, to store the ID of the character that would get created. At runtime the game checks for those CharacterTiles, then creates the relevant character at the tile's position.
I could not find a reasonable way to get the position of the Tile from a reference like the ones found in Tilemap.GetTilesBlock(), so instead I am looping through every cell position within the TileMap's bounds. This works, but seems wasteful to me - Is there a way to do this / an alternate solution?
Your answer
Follow this Question
Related Questions
Editing tiles (and tile sprites) at runtime 0 Answers
Correct use of setTile to add tile to Tilemap 0 Answers
How can I access to a tile properties in a Tilemap? 0 Answers
tilemap.SetTile not working for animated tiles 1 Answer
Can I generate a Tile Palette made up of custom/scriptable Tiles as opposed to default Tiles? 0 Answers