OnCollisionEnter2D: Some collision really happened, means two objects collide with each other.
OnTriggerEnter2D: Collision not really happened when you set up Is Trigger
is true.
For example, if two objects, one with Is Trigger
off (Object A), the other with Is Trigger
on (Object B). So Object A can pass Object B.
Few things in order to make sure the OnTriggerEnter2D()
get called on Object B.
- Both Object A and Object B must have the
Collider
- Object B must have the
Is Trigger
on - Be careful about the friction. If the Object A and Object B are two far away, Object A might cannot collide with Object B.
And that is it!