I’ve had this issue for a while now in the Tilevania course, where my player character will randomly get stuck on a tile and will have to jump out to release himself. It will be fine for a while then randomly happen and once it does it will almost be constant. I thought it had left on its own but now I’m at the stage of making the 3 Levels it has showed its ugly head again.
Could I be doing something wrong with the player feet collider?
Sometimes, the shape of the tilemap collider is not calculated correctly. If you spot a strange gap, disable the tilemap collider component and reenable them again to make Unity recalculate the shape.
Also try to set the “Collision Detection” of the player’s Rigidbody2D component to “Continuous” if you haven’t already.
Hi !
thanks but I tried those solutions and it still doesn’t work. I only have this issues on the tile collisions themselves, if I put another game object as a child under my PlatformTileMaps and give it its own box collider I can walk along it fine with no issues
but this kind of makes the whole tilemap process redundant
I think that the problem might indeed be caused by the tilemap collider. See here:
At the moment, each tile is surrounded by an edge leaving a tiiiny gap between them where the player could get stuck. To prevent that from happening, we need one edge around the overall shape of your tilemap.
Like this (but in green, not red):
Is there also a CompositeCollider2D attached to the “PlatformTilemap” game object? If not, add one and set the “Geometry Type” to “Outline”. In the TilemapCollider2D component, enable “Used by Composite”.
And you also added the CompositeCollider2D? What collider shape did you get after you enabled “Used by Composite”?
If the player falls through the ground, it might be that the tilemap collider became a trigger collider. Make sure “Is Trigger” is not enabled in the CompositeCollider2D component.