Search Issue Tracker
Fixed in 2022.1.X
Votes
0
Found in
2022.1.0a15
Issue ID
1382843
Regression
Yes
[SceneTemplate] Opening Unity when a "LastOpenedScene" is set but the scene does not exist throws an exception
When opening a project, if the user preference "LastOpenedScene" is set but the scene does not exist in the project, an exception is thrown:
ArgumentException: Scene file not found: 'MyScene.unity'.
at (wrapper managed-to-native) UnityEditor.SceneManagement.EditorSceneManager.OpenScene_Injected(string,UnityEditor.SceneManagement.OpenSceneMode,UnityEngine.SceneManagement.Scene&)
at UnityEditor.SceneManagement.EditorSceneManager.OpenScene (System.String scenePath, UnityEditor.SceneManagement.OpenSceneMode mode) <0x195b5c730 + 0x0006a> in <d31e8d7dbcc24e419237a5e086ab705e>:0
at UnityEditor.EditorApplication.Internal_RestoreLastOpenedScenes () [0x00030] in /Users/alexey/Unity/unity/graphics/Editor/Mono/EditorApplication.cs:514
If this starts failing once, you are stuck with this exception until you open a project that either has this scene, or sets the preference key to another value.
Steps to reproduce:
- Create an empty 3d project.
- Close the project
- In a command line, write (or any other command to open unity with arguments) : "path/to/unity -projectpath path/to/my/project -openscene potato"
- The project will open with an exception in the console. Now, every time you open unity (without -openscene), with this project or another, you will get this exception.
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
- Redoing creation of Sub Scenes and Cube GameObjects in Hierarchy throws “Assertion failed on expression: 'targetScene != nullptr’” error in Console window
- Selecting “New Sub Scene” after assigning “New Scene” in Sub Scene Script Component throws “Destroying GameObjects immediately is not permitted” in the Console window
- Shader Graph "Zoom Step Size" can be set to 0 even though the zoom still works
- Enabling/Disabling the Deprecated Nodes doesn't apply to the opened Shader Graph unless any Variable is added to the Blackboard
- Group Selection title text size is smaller in renaming than the actual font size
Resolution Note (fix version 2022.1):
Fixed an endless exception thrown when opening a project with a specified scene if the scene does not exist.