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);
}
}