OnTriggerEnter2D v.s. OnCollisionEnter2D

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.

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.

  1. Both Object A and Object B must have the Collider
  2. Object B must have the Is Trigger on
  3. 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!

About: arkilis

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.