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

Tilemap not generating colliders

Discussion in 'Physics' started by summerian, Dec 11, 2019.

  1. summerian

    summerian

    Joined:
    Jul 6, 2014
    Posts:
    140
    Unity 2019.3f1

    I have added the Tilemap Collider 2D to the tilemap as seen below. I have a player object with a rigibody that falls right through. It also doesn't seem like the editor window has the green outline that indicates a collider.
    Could it be that it's because I use a scriptable tile?

    upload_2019-12-11_17-37-0.png

    Thanks for reading.
     
  2. summerian

    summerian

    Joined:
    Jul 6, 2014
    Posts:
    140
    I just tried with a single non scriptable sprite tile and collisions work. So I'm thinking it has to do with the tile being scriptable. Or because sprite mode is set to "multiple".
     
  3. summerian

    summerian

    Joined:
    Jul 6, 2014
    Posts:
    140
    Figured it out.

    Had to set it in the GetTileData override
    Code (CSharp):
    1. public override void GetTileData(Vector3Int location, ITilemap tilemap, ref TileData tileData)
    2.   {
    3.     tileData.colliderType = ColliderType.Sprite;