How would I prevent ghost vertices?

My tile-based platformer has a box collider2d assigned to each tile. My character also has a box collider2d. My character occasionally gets stuck on the vertices of some tiles. These are called ghost vertices. How would I prevent this?

Using edge colliders instead of box colliders will solve the problem, this thread discusses it. http://forum.unity3d.com/threads/rigidbody-getting-stuck-on-tiled-wall.220861/

Your question is a bit confusing. Using ghost vertices is a way to prevent unwanted collision response. Unity actually uses Box2d as 2d physics engine. However it’s integrated into Unity and you can’t use all features as if you would use Box2d directly. Box2d is written in C++ (just like the Unity core). So there’s no way to directly use it from Unity’s scripting environment (which is implemented with Mono). Inside Untiy you can only use what the Unity API provides.

So you can’t implement ghost vertices in a Unity EdgeCollider2d since it can only represent a continous edge / series of points. It’s not possible to specify additional vertices which are not used as edge but are taken into account for calculating the collision response.

Your only option is to “bevel” the corners of your colliders. So where two colliders meet each other you would add another 45° edge which might overlap with the other collider so the character can’t hit a vertical edge which is the reason why an object get stuck…