Hi there! I’m running into a problem where OnTriggerExit is rarely not being called when the player object leaves a trigger volume. It seems that this happens when the player objects leaves the trigger volume at the exact moment they come down from a jump - So I think it has to do with a collision happening at the exact same moment. To be clear:
- I’ve got a character controller on a box collider ground.
- I have a very large box collider trigger that intersects with half the ground, such that the player can cross into this trigger or leave again.
- Sometimes OnTriggerExit is not called properly. I am not 100% certain about this, but I’m pretty sure:
OnTriggerExit is not being called when the player jumps while inside the trigger, and leaves the trigger at the exact moment their feet touch the ground.
Any ideas?
UPDATE: I’ve been able to reproduce this issue without jumping. If I greatly lower the timeScale, I can move slowly into a trigger until OnTriggerEnter is called, and then often slowly move out without OnTriggerExit being called.
Final update: I’m almost certain this is a Unity problem I can’t fix, so I just worked around it. In my case, because the problem had to do with locking the camera with a trigger (and thus, the problem was that the player could wonder off screen when OnTriggerExit wasn’t called) I just implemented a renderer.isVisible check in case this bug happened, which causes the camera to exit its locked state. Not an ideal situation, but the problem’s solved…