Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Tilemap - Bounds (bug?)

Discussion in '2017.2 Beta' started by luispedrofonseca, Oct 11, 2017.

  1. luispedrofonseca


    Aug 29, 2012
    Hi, I'm trying to know the current size of a tile map and for that I've experimented with "localBounds" and "cellBounds" but their behaviour is a bit weird.

    Here's a video of what's happening:

    The white border is a gizmo drawing the bounds rectangle ("cellBounds" in this case).

    Basically it seems that once the bounds grow they never shrink back even if no tile is present.

    Any hints?

    I just noticed there's a "CompressBounds" method that does what I need - removes the empty bounds space. It's just a bit weird this has to be done manually, but I guess that will have to do.
    In the meantime, if someone knows a better way to do this please let me know!
    Last edited: Oct 11, 2017
    Frizle, jehk27 and info_unity581 like this.
  2. ChuanXin


    Unity Technologies

    Apr 7, 2015
    The bounds of the Tilemap represents the largest previously painted area. CompressBounds will compress the bounds to the extents of actual filled Tiles, and is a rather expensive operation so it is not called automatically. CompressBounds can be called from the menu dropdown of the Tilemap inspector (using the gear dropdown button).