Search Issue Tracker
By Design
Votes
0
Found in
2021.3.45f1
2022.3.50f1
6000.0.23f1
Issue ID
UUM-84233
Regression
No
OnTriggerExit2D is called in Play mode when undoing component adding
Reproduction steps:
1. Open the attached “ReproProj” project
2. Open the “Assets/trigger-event-test“ scene
3. Enter the Play mode
4. Select the “Small Object 2D” GameObject in the Hierarchy view
5. Add any component to the GameObject
6. Undo the component adding via CTRL+Z
7. Observe the Console logs
Expected Result: No OnTriggerExit2D logs are thrown
Actual Result: OnTriggerExit2D is called
Reproducible with: 2021.3.45f1, 2022.3.50f1, 6000.0.23f1
Reproducible on: Windows 11 Pro
Not reproducible on: No other environments tested
Note: Not reproducible with 3D Colliders
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
- GPU utilization increases by 20% on Meta Quest headsets when Render Graph is enabled on 6000.0.16f1 and higher
- Value on Slider (Int) control in UI Builder displays as default when saving UI Document
- Color mismatch in UI Builders Library panel when the Editors theme is set to Light Mode
- [Android ] "AndroidJNI.ToBooleanArray" returns a random non-zero value instead of "IntPtr.Zero" when the method argument is null
- Non-HDR color picker opens when selecting material color with HDR enabled
Resolution Note:
This is not a bug. Undo is not controlled by 2D/physics and fundamentally it disables/enables the components in a GameObject.
In 2D physics, it has a feature that will produces Exit callbacks when a physics object is disabled/destroyed at runtime (in playmode). This is entirely expected behavior.
In 2D, this is controlled by the option: https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Physics2D-callbacksOnDisable.html which also can be set in the physics settings.
If the user does not want this then they can simply disable this option.
3D physics does not have this feature and does not produce such a callback, but it is not a rationale to infer a bug for 2D physics