- Home /
Tilemap rect larger than object
I'm pretty new and I'm sure I'm not using the right word for this, but you can really notice the problem when I select the Rect tool, so that's what I'm going with.
When creating a tilemap, the rect becomes much larger than the object itself. How can I get it to just border the edges of what I drew? It really messes up positioning when trying to instantiate objects.
Answer by fifsus · Apr 07, 2020 at 06:49 PM
I'm having the same problem. The rect just wouldn't shrink after removing tiles and due to that, the tilemap.size and tilemap.origin would show weird coordinates. At the end I ended up creating a new tilemap with the desired size and deleted the old one. Now still when I create a new tilemap and put some tiles in, after removing them, the rect still doesn't shrink. I feel like there is some issue with Unity.
Answer by lwlook · Sep 18, 2021 at 09:25 PM
Instead of deleting the whole tilemap, you could just simply compress it. Than it will shrink to the size of the filled tiles.
To compress a tilemap: Tilemap GameObject -> Tilemap Component -> Three dots on the right -> Compress Tilemap Bounds.
Your answer
![](https://koobas.hobune.stream/wayback/20220612224225im_/https://answers.unity.com/themes/thub/images/avi.jpg)