Search Issue Tracker
Won't Fix
Votes
0
Found in
2018.4
2019.4
2020.3
2021.1
2021.1.3f1
2021.2
Issue ID
1337272
Regression
No
SetParent does not work OnDestroy() when new parent is in DontDestroyOnLoad scene
Reproduction steps:
1. Open attached project "Reparent.zip" and scene "SampleScene"
2. Enter Play Mode
3. After waiting 5 seconds, In Hierarchy window, observe DontDestroyOnLoad scene's "Global" GameObject
Expected result: The "Global" GameObject has two children
Actual result: The "Global" GameObject has no children
Reproducible with: 2018.4.35f1, 2019.4.28f1, 2020.3.11f1, 2021.1.9f1, 2021.2.0a19
Notes:
1. Issue does not reproduce when reparenting to DontDestroyOnLoad scene without OnDestroy()
2. Issue does not reproduce when reparenting in the same scene with OnDestroy()
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
- Brush Size in the Inspector window does not update when the Brush Size in Scene View is changed
- "ArgumentOutOfRangeException" errors are thrown every time a keyboard key is pressed when renaming a component in UI Builder with a symbol and changing the name after label attribute warning
- Values in "Rect Transform" component are only partially updated when changing values in Prefab Mode
- Same Asset Type Focused Inspectors do not repaint when menus are manipulated
- Bool or Trigger Parameters can be selected via right clicking to the right of a Parameter control in the Animator Window
Resolution Note:
After calling LoadScene it's not possible to try and avoid the deletion of the objects, once you get OnDestroy you can’t prevent destruction of the object. Before calling LoadScene you need to re-parent the objects you don't wish to be deleted.