If I understand correctly, according to the Unity API, OnTriggerEnter2D() is run whenever another object enters the trigger on the current object (e.g if A’s script has OnTriggerEnter2D() and it has a trigger, it will run when B enters it)
However, I’ve noticed that when B has OnTriggerEnter2D() (also, B doesn’t even have a trigger collider), when it collides with A (which DOES have the trigger) the method still runs.
This isn’t necessarily a problem I just was wondering if anyone knew why this happened?
TonyLi
2
That’s the way it’s designed. Whenever there’s a collision with a trigger, both objects receive OnTriggerEnter() / OnTriggerEnter2D() messages, not just the object with the trigger.