Search Issue Tracker
By Design
By Design in 6000.3.X
Votes
0
Found in
2021.3.46f1
2022.3.52f1
6000.0.27f1
6000.1.0a4
6000.2.0a1
6000.3.0a1
Issue ID
UUM-87097
Regression
No
GameObjects with "hideFlags.DontSaveInEditor" paired with the "DontDestroyOnLoad" method are not relieved up when the Play Mode is exited
How to reproduce:
1. Open the “HideFlagsBug.zip“ project
2. Open the “New Scene“
3. Enter Play Mode
4. Observe the Console
5. Exit Play Mode
6. Do steps 3 and 5 at least once more
7. Observe the Console
Expected result: Nothing is logged
Actual result: “There are <number of> audio listeners active in the scene“ is logged
Reproducible in: 2021.3.46f1, 2022.3.52f1, 6000.0.27f1, 6000.1.0a4
Reproduced on: Windows 11 Pro (23H2)
Not reproduced on: No other environment tested
Notes:
- The audio listener count increases by one every time Play Mode is entered
- Visually, there is only one Audio Listener in the Scene
- Memory usage also slightly increases each time Play Mode is entered
- There is only one Audio Listener Component enabled in the Scene at any time
- Reproduces when the “HideFlags“ option is “DontSaveInEditor“ or any other option that includes it (i.e. “DontSave“, etc.)
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
- Required SpriteMask class (ID 331) is stripped when "Strip Engine Code" is enabled
- “Maximized serialized file backup not found” error is thrown when minimizing a window in a newly opened project
- Build stack trace contains invalid lines when building with IL2CPP using scripts with delegates containing generic types in the signature
- Entities Systems window has a “Show Full Player Loop” dropdown which does nothing when clicked after enabling “Show Full Player Loop”
- Entities Hierarchy Search “Show/Hide” button’s Lens Icon is blurry when the Editor is on an external monitor
Resolution Note:
The HideFlags.DontSave flag forces the EditorSceneManager to completely ignore an object during scene restoration after exiting playmode. The documentation (below) states that if you set this flag on a GameObject, you are responsible for manually cleaning up the object by using DestroyImmediate(...). You can do this pretty easily by subscribing to the EditorApplication.playModeStateChanged event and destroying the object when entering Edit Mode.
https://docs.unity3d.com/6000.1/Documentation/ScriptReference/HideFlags.DontSave.html
Resolution Note (6000.3.X):
The HideFlags.DontSave flag forces the EditorSceneManager to completely ignore an object during scene restoration after exiting playmode. The documentation (below) states that if you set this flag on a GameObject, you are responsible for manually cleaning up the object by using DestroyImmediate(...). You can do this pretty easily by subscribing to the EditorApplication.playModeStateChanged event and destroying the object when entering Edit Mode.
https://docs.unity3d.com/6000.1/Documentation/ScriptReference/HideFlags.DontSave.html