Search Issue Tracker
Fixed in 2022.2.X
Votes
0
Found in
2019.4
2020.3
2021.2.18f1
2021.3
2022.1.0a16
2022.2
Issue ID
1420510
Regression
Yes
Objects which are instantiated as Children and have HideFlags.DontSave flag don't get destroyed when entering a different scene
Reproduction steps:
1. Open "CubeTest" project
2. Open "Test" Scene
3. Select the "TestScript" Object in the Hierarchy
4. Enable the "Test (Script)" component
5. Observe the cube in the Scene view.
6. Create an empty scene File -> New Scene
Or:
1. Open "CubeTest" project
2. Go to Window -> General -> Test Runner
3. Press "Run All"
Expected result: Cube with HideFlags.DontSave flag doesn't appear in a newly created scene
Actual result: Cube with HideFlags.DontSave flag appears in a newly created scene
Reproducible with: 2019.4.38f1, 2020.3.33f1, 2021.3.1f1, 2022.1.0a16, 2022.1.0f1, 2022.2.0a11
Not reproducible with: 2022.1.0a1, 2022.1.0a15
Note: If testing with Test Runner, the issue is reproducible when tests fail
Comments (1)
-
Xtro
May 10, 2022 16:20
Unity is "BUG by Design".
This is NOT FIXED AT ALL. They just don't care about a very serious bug which surfaced in a recent Unity version.
If my life didn't depend on it, I would quit it this very moment.
Young developers: DON'T USE UNITY for the sake your own future.
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 _platform_memmove when importing the "Dragon Crashers - URP 2D Sample Project" to a new 2D project
- "Shader is not supported on this GPU" warnings and and shaders are not loading when building the project for non-Chromium browsers
- [iOS][URP] The screen flickers and the "Execution of the command buffer was aborted due to an error during execution" error is thrown continuously
- Shortcut Manager shows empty conflict filter when resolving runtime conflicts involving different contexts
- Building the project for Web with ASTC Texture Compression results in black screen
Resolution Note (fix version 2022.2):
Fixed in: 2022.2.0a13
The behavior described is by design and it was actually a bug that triggered the old behavior.
When marking this bug as resolved, we will not change the current behavior but instead update the documentation and added examples for HideFlags.DontSave (in the context of HideFlags.DontSaveInBuild and HideFlags.DontSaveInEditor) to better explain what to expect from HideFlags.DontSave.
When setting the HideFlags of a root GameObject with HideFlags.DontSave, you are expected to manage the lifetime of the GameObject hierarchy and destroy it when needed. The children follow the lifecycle of the parent, as is the norm in Unity.