Search Unity

  1. We are looking for feedback on the experimental Unity Safe Mode which is aiming to help you resolve compilation errors faster during project startup.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Tile Map Is there any way to "refresh" the tile map size?

Discussion in '2D Experimental Preview' started by muffin1, Oct 2, 2016.

  1. muffin1


    Sep 25, 2016
    Hi all,

    I'm wondering if there is any way to refresh the tile map size.

    If I create a tile map and start drawing, the tile map size will increase, but if I delete some of the tiles at the edges the actual returned value (tileMap.size.x and tileMap.size.y) return the original value.

    Is there any way I can manually (or automatically) refresh/recalculate this boundary so I can have the correct value returned?

    I am clamping the camera position to the size of the tile map, and this is where the issue was found. I've tried calling "RefreshAllTiles()" and also tried getting the values from "tileMap.size" and "tileMap.editorPreviewSize" with no luck.

    I've noticed that in the scene view that if you select the "rectangle" tool (the 5th icon, right of the hand/grab tool) and then select the tile map layer it will show you the current bounds. Some times if I just keep within the original boundary it will work, but sometimes just drawing a box will make the boundary bigger than the actual map.




    I've found a different way to access the values I needed so this isn't much of an issue anymore.

    I'm now getting the values from the TileMapCollider2D component using it's bounds center point and size.

    Still would be good to know of a way of fixing the original problem but this method works fine.

    Attached Files:

    Last edited: Oct 2, 2016
  2. Frizle


    Sep 12, 2017