Hello friends, I have a problem with collision detection and I do not know what to do ! I have a simple 2D surface (with BoxCollider2D no rigidBody2D). And I have a mario like character which walks on this surface. When a character stands still, all is good, only OnCollisionStay2D shoots. But when character walks, on this continious surface with BoxCollider2D, OnCollisionExit2D and OnCollisionEnter2D alternately are called. This weird nature of behavior completely destroys my collision engine logic. I do not wish to start working with raycast, I want to receive only OnCollisionStay2D as long as I stand, or walk, on the same BoxCollider2D. Without this weird OnCollisionExit2D/OnCollisionEnter2D alternation,
Perhaps use the Physics2D function IsTouching instead. https://docs.unity3d.com/ScriptReference/Physics2D.IsTouching.html
You should not get an exit callback if you're not separating from the surface. Sounds like something else is going on beyond your description. Do you have a simple reproduction case you can share or even a bug report? Also, can you state what version you're using please.