Tilemap collider 2D not working


I’m working on an isometric dungeon crawler game. I use tilemaps to create the level, but I can’t get the player to collider properly with the walls.
I use the tilemap collider 2D on the walls and rigidbody 2D and box collider 2D on my player.

I hope you can help me :slight_smile:

Does it not generate colliders at all? If that’s the case what I’ve found is that changing the tiles’ Collider Type to Grid fixes it, that’ll make it so it generates the collider based on the shape of the grid and not the sprite, but at least it works. (If not I’ll still leave it here because I found this question looking for an answer for my issue and now that I know it may help others)

Hello per-spective. The following checklist might help you identify where your problem is.

  1. is your player’s Rigidbody2D Dynamic, and are you moving the player through the Rigidbody2D directly? If your player is Kinematic, you’ll have to detect collisions manually in code, so a Dynamic body is the easier place to start. It’s also recommended you use something like “MovePosition” instead of tweaking the transform directly.
  2. Does your tilemap have a Rigidbody2D attached to it as well? It’ll need one if your player is to interact with it. A Tilemap will probably want the Body Type to be Static.
  3. Do your tile sprites have their colliders set up correctly? The quick and dirty way to do this is, for the sprites you’ve used to create your tile map, check “Generate Physics Shape” for impassable tiles, and uncheck “Generate Physics Shape” for passable tiles. Alternatively, you could have a separate Tilemap containing your impassable tiles, which has your Collider + Rigidbody2D, and another tilemap for passable tiles which has neither. Either way, you’ll want your impassable tiles to either have “Generate Physics Shape” checked, or go into the Sprite Editor and create a “Custom Physics Shape”.