Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Tilemap Collider 2D generates collision differently in edit and play modes.

Discussion in '2D' started by ScottySR, May 25, 2023.

  1. ScottySR

    ScottySR

    Joined:
    Sep 29, 2018
    Posts:
    48
    We recently noticed a bug where a Tilemap Collider 2D didn't generate any collision for slope tiles. This used to work before without any issue, so I'm not sure what changed and when. After investigating this a bit I noticed that the slopes are part of the final collider in edit mode, but not in play mode. What could cause this?
     
  2. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    Hi, would it be possible to file a bug with your project using the Unity bug reporter and post the case number here? We'll take a look at this issue!
     
  3. ScottySR

    ScottySR

    Joined:
    Sep 29, 2018
    Posts:
    48
    I'm not able to make a bug report if it attaches the project to the report. I did find out that when the RuleTile's default collider is set to "Sprite", the collision doesn't work, which is probably why it didn't work on slopes, but worked on box shapes, because they used "Grid" mode. Changed them to "Sprite" too, and they stopped working too. I tried adding custom physics shapes to the tiles, but that didn't seem to do anything. The collision is still correct in edit mode, though.

    EDIT: The tiling rules also had "Collision" set to "Grid" for box shaped tiles, so I changed those to "Sprite" as well when doing the test
     
  4. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    If a bug report is not possible, would it be possible to share an image of your Sprites, the Texture settings for your Sprites, the Custom Physics Shapes and your RuleTile set up? Having the version of the Unity Editor and the Tilemap Extras package would be helpful too. Thanks!