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
- Tile Palette Window zoom level resets when the Window becomes inactive
- [iOS] Exported Xcode "Unity-iPhone" Xcode project shows the "Framework" folder as red
- Hierarchy cannot be scrolled horizontally
- [WebGL][iOS] "WebCamDevice.isFrontFacing" is always logged as true on an iOS WebGL when the system language is set to Non-English option
- GameObject passes through other GameObjects and ignores depth on the Z axis when using HDRP with render pass set as "after post-process" and anti-aliasing mode set as "DLSS" or "TAA"
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