2D Geometry Dash Clone Player Stuck Between Tiles

I was playing Geometry Dash one day and thought, “Hey, this should be easy to make in Unity!” so I got to work. After a good bit of work, I have something playable going, but I have noticed that my player can sometimes get stuck between two tiles that make a flat surface. (Yes, I am using the slippery physics material but it still gets caught.) I tried changing the BoxCollider2D to a CircleCollider2D, and it fixed that problem, but sometimes the CircleCollider2D would slow down slightly when it landed from a jump, even though I put the slippery material into the new collider.

I need it to not get caught between tiles with a box collider, or I need it to keep its horizontal velocity on a flat surface or when hitting the ground after a jump with a circle collider.

What should I do to fix this? Is this possibly a glitch in Unity that cannot be avoided (If so, what kind of workarounds can I use?)?

This is just an artifact of how Box2D works and TBH how most physics engines work. It calculates collisions for each collider separately. A good write-up of it can be found here.

The EdgeCollider2D is designed to resolve this problem by allowing you to create a continuous surface of edges which won’t have this problem. That is also much more efficient than adding lots of box colliders.

Finally, I’m working on a CompositeCollider2D in Unity that allows blending of multiple collider shapes which will also stop this issue. You can see more info on this on my Twitter feed.

https://twitter.com/melvmay/status/715165831680884736

https://twitter.com/melvmay/status/715536626231980032

https://twitter.com/melvmay/status/718827746042974210