Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Composite Collider 2D stops being created after a certain distance from center of Tile Map

Discussion in '2D Experimental Preview' started by AssembledVS, Dec 5, 2016.

  1. AssembledVS

    AssembledVS

    Joined:
    Feb 23, 2014
    Posts:
    248
    Tiles with Tilemap Collider 2D collision shapes stop working with the Tile Map's Composite Collider 2D once placed a certain distance from the Tile Map object's center. Once "Used by Composite" is unchecked, however, their individual collision shapes continue to work. In my project using a pixels to units setting of 16, this starts happening about 214 units in every x/y direction from the center.

    It is unclear to me whether this behavior is intended or known, but I see nothing in the documentation suggesting otherwise.

    If this behavior is intended or must exist, we should be able to know exactly how large our individual tilemaps can go before breaking the Composite Collider 2D system. This way, we will easily be able to combine Tile Maps for larger worlds. Please correct me if I'm wrong, but at this point, the Tile Map's grid makes it seem like it is an "infinitely" large tilemap, with no bounding gizmo suggesting otherwise.
     
  2. Johaness_Reuben

    Johaness_Reuben

    Joined:
    Jan 27, 2016
    Posts:
    253
    Just tested it - seems like there is a bug here. Thanks for catching that.
     
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,324
    I'll take a look but it would help if you could provide an reproduction case. What do you mean by units? Could you give me an idea of world size your're talking about? Have you tried colliding with things that don't appear as it might be a problem with the gizmo drawing rather than there not actually being a collider shape there.

    It would be good to get a project but if you could at least describe the composite setting and world sizes you're referring to it would help reproduce it.
     
  4. AssembledVS

    AssembledVS

    Joined:
    Feb 23, 2014
    Posts:
    248
    By "units," I mean the transform position increments in space. Meaning at -214 x to 214 x and -214 y to 214 y. The collision does not work beyond these points; it's not just the visibility of the collision shapes. When "used by composite" is unchecked, however, both the collision shapes are drawn and the collision works.
     

    Attached Files:

  5. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,324
    That is extremely odd indeed. Thanks for the project, I'll give it a test.
     
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,324
    So I've been digging through this all evening but I've finally tracked down the issue. It's due to a bad cast internally. I'll get a fix and see if it's possible to get a new preview#3 release patch or something. I'll keep you updated.

    BTW: I wanted to add that I really appreciate you finding this; I've seen a similar issue before but only once and it troubled me that I couldn't track it down.
     
    AssembledVS likes this.
  7. AssembledVS

    AssembledVS

    Joined:
    Feb 23, 2014
    Posts:
    248
    This is good to know, thanks!

    I wasn't actually making a large map when I found this. My scene's action was not at the origin (due to the canvas being at the origin and getting in the way) and this is why I found it.

    Also, I'm not sure if you noticed: drawing colliders past +214y (at the top part) while composite is checked creates a long collider shape that stretches all the way down. Not sure if this is related.
     
  8. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,324
    Yes, the problem affects both axis. I've asked internally and it might be possible to get an updated release next week.