Hello all,
In my script, I’m wanting to get the Tile at a certain location in the TileMap. However, there only seems to be methods to get the TileBase, which as far as I can tell, is pretty useless.
Tile getTile(TileMap tileMap, Vector3 pos) {
Vector3Int tilePos = tileMap.WorldToCell(pos);
var tile = tileMap.GetTile(tilePos);
return tile;
}
This, of course, doesn’t work, because GetTile
only returns the TileBase.
You can specify a T for GetTile, but
var tile = tileMap.GetTile<Tile>(tilePos);
comes back with an error saying you can’t implicitly convert a TileMap to a Tile.
I’ve been at this for hours, and can’t find any solution. I have no idea why Unity would return the TileBase when there’s next to nothing you can do with it, but make the Tile itself almost impossible to get.
Thanks for any help.