Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Tile Map Regenerate tile map polygon collider after modifying at runtime?

Discussion in '2D Experimental Preview' started by Jay-Pavlina, Jun 20, 2016.

  1. Jay-Pavlina

    Jay-Pavlina

    Joined:
    Feb 19, 2012
    Posts:
    195
    I know this is a preview and that the tile map collider is going to change, but I was wondering if there is any way to regenerate the tile map's polygon collider at runtime. Currently, if I remove a tile at runtime, the polygon collider does not update, and I don't see any way in the API to trigger an update.
     
  2. Sir-Spunky

    Sir-Spunky

    Joined:
    Apr 7, 2013
    Posts:
    132
    You can remove and add a new polygon collider component to the tilemap gameobject through script, which should generate it again. However, I could not get this to work after building the game for Windows (it only worked in Play mode within Unity).
     
    Jay-Pavlina likes this.
  3. Jay-Pavlina

    Jay-Pavlina

    Joined:
    Feb 19, 2012
    Posts:
    195
    OK, that sounds like a good enough workaround for now. Thanks!