How get size of tilemap?


#1

I need to get width and height of the tilemap, how do it?
Thanks!


#2

#3

thanks, but Is there a way to get size in pixels (or similar units)?


#4

Not directly, but it’s easy enough to calculate since you know the size of each tile.


#5

is there clean way to get size of tile, i want reuse my script ?


#6

No, but you can add a property to your script and set it for each instance.


#7

ok, thanks for the help


#8

I would prefer to get tile size from tilemap - it seems safer. If you ever change the tile size you have to also change property which is no big deal, but still another layer of mistakes . And knowing that tilemap already provides it’s size in number of tiles, giving a size of tile map (or a tile size itself) in pixels seems convenient. What do you think?