do ontriggerenter functions of parent game objects run when the collider is on a child…
- User
do ontriggerenter functions of parent game objects run when the collider is on a child in unity
- Assistant
In Unity, when a collider on a child GameObject of a parent GameObject triggers an event (like OnTriggerEnter), the method will not only be executed for that child but also can propagate events to the parent objects if they are set up to respond to those events.
However, the OnTriggerEnter function itself must be defined in the script of the GameObject that has the collider component, which means if the collider is on a child GameObject, the OnTriggerEnter function must be located in the script attached to that child GameObject to capture the event.