# EventHandler.OnTriggerEnter/Exit does not look at the Attached RigidBody

**URL:** <https://qa.fmod.com/t/eventhandler-ontriggerenter-exit-does-not-look-at-the-attached-rigidbody/15776>\
**Category:** Unity\
**Created:** [May 15, 2020, 11:41pm UTC](https://qa.fmod.com/t/eventhandler-ontriggerenter-exit-does-not-look-at-the-attached-rigidbody/15776 "2020-05-15T23:41:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wiverson](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/wiverson/32/923_2.png) [@wiverson](https://qa.fmod.com/u/wiverson)\
**Post date:** [May 15, 2020, 11:41pm UTC](https://qa.fmod.com/t/eventhandler-ontriggerenter-exit-does-not-look-at-the-attached-rigidbody/15776/1 "2020-05-15T23:41:03Z")

</div>

I just found that the EventHandler OnTriggerEnter and OnTriggerExit look only at the collider, not the attached RigidBody for purposes of tag detection. I have the Player tag set on the RigidBody, but not on the children.

Here is the change I made to EventHander.cs to make it work as I expected. A slight “hardening” might be to make it perform a null check before accessing attachedRigidbody.

Thoughts…? It seems this is closer to the intent…?

void OnTriggerEnter(Collider other) {  
if (string.IsNullOrEmpty(CollisionTag) || other.CompareTag(CollisionTag) ||  
other.attachedRigidbody.CompareTag(CollisionTag)) {  
HandleGameEvent(EmitterGameEvent.TriggerEnter);  
}  
}

```
    void OnTriggerExit(Collider other) {
        if (string.IsNullOrEmpty(CollisionTag) || other.CompareTag(CollisionTag) ||
            other.attachedRigidbody.CompareTag(CollisionTag)) {
            HandleGameEvent(EmitterGameEvent.TriggerExit);
        }
    }
```

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [May 25, 2020, 5:40am UTC](https://qa.fmod.com/t/eventhandler-ontriggerenter-exit-does-not-look-at-the-attached-rigidbody/15776/2 "2020-05-25T05:40:07Z")

</div>

Thanks for bringing this to our attention, I have raised a task to investigate this further.
