Search Issue Tracker
Won't Fix
Votes
0
Found in
2021.3.40f1
2022.3.38f1
6000.0.11f1
7000.0.0a1
Issue ID
UUM-75780
Regression
No
Script Execution Order setting is not respected when reloading a Scene
Reproduction steps:
1. Open the attached “BugRepro” project
2. Open the “Assets/Scenes/MainScene” Scene
3. Enter Play Mode
4. In the Hierarchy window, select the “SceneController” GameObject
5. In the Inspector window, open the context menu of “Scene Controller” script
6. In the context menu, select “RestartScene”
7. Observe the logged execution order in the Console
Expected result: OnDestroy() is executed in the “Scene Controller” script first and then in the “Test Behaviour” script
Actual result: A custom warning message is logged, that OnDestroy() was called in “Test Bahaviour” script before “Scene Controller” script
Reproducible with: 2021.3.40f1, 2022.3.38f1, 6000.0.11f1
Reproducible on: Windows 11
Not reproducible on: No other environments tested
Note: The issue does not always reproduce, so steps 4-7 might need to be repeated multiple times
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
- Spot Light with 'Box' Shape stops working when it collides with Mesh
- Accepting Asset Store EULA endless loop in Package Manager window
- “InvalidOperationException: Sequence contains no matching element“ error when reenabling a custom Debug Draw Mode
- Prefab that contains a layout group is marked as changed by the Editor when opened
- Emission animation does not appear when the "Emission Map" parameter is set to black in a Lit material
Resolution Note:
OnDisable and OnDestroy never respected execution order settings. Changing this behavior is risky as it will affect users which are relying on executing OnDisable and OnDestroy based on the order in which MonoBehaviors are added to a GameObject
I updated the documentation to reflect this behavior