Search Issue Tracker
Won't Fix
Votes
0
Found in
2020.3.45f1
2021.3.19f1
2022.2.7f1
2023.1.0b5
2023.2.0a3
Issue ID
UUM-27272
Regression
No
OnTriggerExit does not activate when a GameObject inside a Trigger is set to Inactive or Destroyed
How to reproduce:
1. Open the attached “IN-22896” project
2. Open the “SampleScene” Scene
3. Enter Play Mode
4. Use A/D keyboard keys to move into the Cube shaped GameObject
5. Open the Console window and note the “OnTriggerEnter” being printed
6. Press the “F1” key on the keyboard, while the Sphere shaped GameObject is still in the Cube
7. Observe the Console window
Expected result: OnTriggerExit is printed/triggered
Actual result: OnTriggerExit is not triggered
Reproducible with: 2020.3.45f1, 2021.3.19f1, 2022.2.7f1, 2023.1.0b5, 2023.2.0a3
Reproducible on: macOS Ventura 13.1 (Intel), Windows 10 - User Reported
Notes:
- Documentation of OnTriggerExit states: “OnTriggerExit is called when the Collider other has stopped touching the trigger.” In this issues regard, this statement can be interpreted as false
- Relevant Documentation page: https://docs.unity3d.com/ScriptReference/Collider.OnTriggerExit.html
- “F1” key triggers Destroy(Object), “F2” key triggers setActive(False)
- Reproducible in Builds
- Reproducible on a new project
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
Resolution Note:
Unfortunately, the trigger events are not symmetrical on deletion and deactivation currently. That is, if you deactivate an object, or destroy it while inside a trigger volume, it's not guaranteed to register an on exit event due to internal technical limitations.