I noticed that OnCollisionEnter2D does not trigger when two objects with Collider2D components make contact. It only triggers when one of them has a RigidBody attached to it. This seems odd to me, because the Unity editor itself says that having a static collider in place of a non moving RigidBody is much better for performance. Then why does Unity not allow two game objects with static colliders trigger collision events when they make contact?
1
votes
sure, that is THE ENTIRE POINT of the PhysX engine! Forget about "static" colliders, you very rarely use them in ordinary games. You make games with RigidBody. They could remove the "static" feature from Unity, it has only a few obscure uses, and it would make little difference to 99% of games. Just forget about it.
– Fattie
1 Answers
1
votes
Sure, static colliders are more performant, but as the word indicates: they are static.
Movement requires physics calculation and therefore a rigidbody (which holds information about speed etc.). This is actually stated in the docs for the normal collision here http://docs.unity3d.com/ScriptReference/Collider.OnCollisionEnter.html