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|https://docs.unity3d.com/ScriptReference/Collider.OnTriggerExit.html|smart-link]
- “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
- Crash on RaiseException when opening a specific project
- DownloadHandlerScript.CompleteContent is called twice when building for WebGL
- Scene view has Y coordinates of the Screen Position node flipped when some of the URP features are disabled
- Volumetric fog shader variants are missing from build when "Strict Shader Variant Matching" is disabled
- Unnecessary modifications clutter the Scene when using a RectTransform driven by a LayoutGroup in a Prefab
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.