- Home /
OnTriggerEnter and Exit Not Aligned
I have a component that represents an area of my game. It contains several trigger colliders underneath. I have a character that walks around the environment and when he walks into this area, I'd like to apply some effects, logic, etc.
OnTriggerEnter/Exit gets called for every single collider of this particular area. I wouldn't mind that if I could reliably 'reference count' the number of times he's entered and exited to know when to apply and remove the effects. The big problem right now is I get a different number of calls for the Enter and Exit, so there's no way for me to track and remove properly.
One reason I get a mismatch of numbers is because I need to enable and disable the colliders in this area (instantiate/destroy to be precise) and I think when you set a collider to enable = false, it doesn't register the OnTriggerExit.
Has anyone found a reliable workaround to having several trigger colliders represent a single area/trigger that you want to use. I'd appreciate any help on this.
Thanks -Matt