- Home /
Tilemap Border Size
Hello there
Can't find anything about this on the internet. I have created a 2D RPG using tilemaps. I am using a script to figure out the size of the tilemap and then using the size to prevent my player walking off the edge, it works fine on most levels.
But on some levels the tilemap dimensions are not being recorded properly and the player is able to walk off the edge. I think the problem can be seen in this screenshot, you can see the edges of the tilemap are much bigger than the actual painted tiles...
So, how do I make this blue box neatly fit my tilemap and not leave all that empty space? Any help gratefully recieved.
Note: If I simply grab and push the sizing handle it resizes all of the tiles in my tilemap and still leaves the same empty space at the edge.
Answer by MatthewRowe · Mar 30, 2020 at 01:03 PM
Don't worry, sorted, here is the solution...
Firstly double check that you don't have ANY rouge tiles that you've added by mistake (sometimes the same colour as the background) use a temp tilemap collider to highlight all of your tiles. Once you're certain.
Enable debug mode. Click on your Grid (or any object) just above the word "Static" in the properties window click the 3 dots (next to the padlock) and select Debug.
Once you can see the debug options you can then use the tilemap Origin and Size properties to adjust the box.
Hope this helps.
Should've said, you need to enable debug, then run it before you can adjust the sizes properly.
Answer by cjonasw · Mar 24, 2021 at 01:16 AM
"..." -> "Compress Tilemap Bounds"
Your answer
Follow this Question
Related Questions
Unity 2D TileMap Rule Tile Carpet 1 Answer
2D Game Kit Loses Tile Map Colliders 0 Answers
NPC Party Member Direction 1 Answer