Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    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