OnTriggerExit is not called whthen object inside is destroyed

OnTriggerExit is not called when an object that is inside a trigger is destroyed.
Is this a bug or intended behavior?

It’s probably intended. If OTEx was called on destroy, the trigger would get OnTriggerExit(Collider col) with col equal to null (since it was destroyed.) It would be a pain to call OTEx for all triggers, then destroy it. But even then, if col was the “about to be dead” object, OTEx wouldn’t have a good way to distinguish a movement exit vs. a destroy exit. And I often want them to do different things.

In practice, you move around a lot and can’t hand-check Exit each frame. So having OTEx automatically called is good for movement. But you only get destroyed once, and you know you are exiting any triggers, so it makes sense to hand-place clean-up code right before the Destroy.

The hooks aren’t set in stone. There’s no reason Unity couldn’t provide an OnTriggerDestroyExit function. But it would slow the engine a teeny bit, even for people who never use it.

From my experience, you probably want to use the function OnTriggerStay instead.

Looks like this was fixed 2 years ago for Unity 3D (thanks Owen!).

For Unity 2D this was a bug that has been fixed in Unity 5.6.