Search Issue Tracker
By Design
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
- Text is unreadable when DLSS is applied to the Canvas with Render Mode set to World Space
- NullReferenceException errors appear in the Console when changing the values of Visual Effect Control Clip Events' Attributes
- Crash on TextCore::OTL_TableReader::GetOpenTypeLayoutTables when using Japanese Font as TMP Fallback
- TreeView.AddItem performance regression when opening EditorWindow
- Shadows are not visible in Player when using DX12 with Forward+ or Deferred+ rendering in URP
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