2D Toolkit Forum

2D Toolkit => Support => Topic started by: antman on April 19, 2014, 10:12:19 pm

Title: TileMap Bounds
Post by: antman on April 19, 2014, 10:12:19 pm
Is there a way to get the bounds of the tilemap?  I can see them drawn in the editor when play is not enabled (it's a white rectangle in the scene view).

I am going to be removing different tiles from the tilemap so don't want to rely on being able to grab them out of the tilemap.  Is this component at all able to tell you what it's bounds are even if it is missing one or all of its tiles?
Title: Re: TileMap Bounds
Post by: unikronsoftware on April 20, 2014, 10:20:28 am
No the bounds drawing in the editor draws the bounds of the entire tilemap, ignoring empty tiles, etc. You will have to step through the tiles to find the empty ones.
Title: Re: TileMap Bounds
Post by: antman on April 24, 2014, 08:49:11 am
No the bounds drawing in the editor draws the bounds of the entire tilemap, ignoring empty tiles, etc. You will have to step through the tiles to find the empty ones.
What I want is the bounds of the entire TileMap at runtime.  Is there a way to do this without stepping through all of the tiles (I know which ones are empty  ;)).
Title: Re: TileMap Bounds
Post by: unikronsoftware on April 24, 2014, 10:23:50 am
tk2dTileMap.OnDrawGizmos draws the rectangle in the scene view. Should be pretty straightforward to work it out from there.