Hello Guest

Author Topic: TileMap Bounds  (Read 4105 times)

antman

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 9
    • View Profile
TileMap Bounds
« 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?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: TileMap Bounds
« Reply #1 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.

antman

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: TileMap Bounds
« Reply #2 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  ;)).

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: TileMap Bounds
« Reply #3 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.