I just started prototyping some stuff, and wanted to use OnTriggerEnter to detect an attack (if player is swinging). But if the enemy gets too close, and attack is performed after trigger entry, just OnTriggerEnter misses it. So I used OnTriggerStay to see if they are already in contact, in which case an swing triggers a hit without the OnTriggerEnter.
After a hit, the enemy bounces away, and will try to attack again. After about a dozen hits, the OnTriggerStay seems to lose its mind and gets called even when the enemy is nowhere near the player.
I thought I’d be clever and keep a count of Enters and Exits, tracking trigger contact myself instead of using OnTriggerStay. Turns out, it had the exact same problem! So it seems that OnTriggerExit is not getting called in some cases?!
In the end I had to put a distance sanity check in to get around this, which is fine, but I’m wondering if this is a known issue. Anyone else run into this problem?
Thanks!