Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Reset Tilemap bounds to visible only?

Discussion in '2D' started by TSabos, Mar 25, 2019.

  1. TSabos


    Mar 8, 2015
    I've been messing around with navigation lately and discovered that the bounds of a tilemap get moved out if you accidentally draw a tile and then delete it. This makes sense, but is there a way to recalculate what the bounds of a tilemap "should" be given only visible tiles? This is causing my nav to encapsulate an area about 20x the size it should be due to having the wrong tilemap selected some weeks ago and drawing a tile and then deleting it. This also seems good for performance to be able to recalc the bounds of a tilemap after erasing tiles.
  2. RidgeWare


    Apr 12, 2018
    Use tilemap.CompressBounds() to reduce the size of the bounds to existing tiles.
    adriank5 and TSabos like this.