Search Issue Tracker
By Design
By Design in 2023.3.X
Votes
0
Found in
2021.3.29f1
2022.3.8f1
2023.1.10f1
2023.2.0b7
2023.3.0a2
Issue ID
UUM-47111
Regression
No
ScriptableObject instances are destroyed when calling EditorSceneManager.NewScene
How to reproduce:
1. Open the attached “new-scene-behavior.zip“ project
2. Run Script (Bugreport > Run Example Code)
Expected result: The ScriptableObject instance isn’t destroyed
Actual result: The ScriptableObject instance is destroyed and “MissingReferenceException: The object of type 'Editor.MyTestScriptableObject' has been destroyed but you are still trying to access it.“ error in the Console
Reproducible with: 2021.3.29f1, 2022.3.8f1, 2023.1.10f1, 2023.2.0b7, 2023.3.0a2
Reproducible on: macOS 13.4.1 Ventura (Intel)
Not reproducible on: No other environment tested
Note: User reported that saving the ScriptableObject and reloading it after the call to NewScene() works, but is not the expected behavior
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
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
Resolution Note:
Current behavior is the expected behavior.
When any type of object is instantiated it is considered part of a scene unless it is made into an asset.
Which means when the scene is destroyed so is all instantiated objects.
So either make the object into an assets, or set DontSave hideflag which will also keep the object alive as mentioned in the documentation https://docs.unity3d.com/ScriptReference/HideFlags.DontSave.html
Resolution Note (2023.3.X):
Current behavior is the expected behavior.
When any type of object is instantiated it is considered part of a scene unless it is made into an asset.
Which means when the scene is destroyed so is all instantiated objects.
So either make the object into an assets, or set DontSave hideflag which will also keep the object alive as mentioned in the documentation https://docs.unity3d.com/ScriptReference/HideFlags.DontSave.html