Code inspection: Scene does not exist
This inspection detects when a script attempts to load a scene using a name or path that does not exist within the current Unity project. Loading a scene that is not present in the project will lead to runtime errors.
How it works
The inspection monitors calls to scene management methods, such as SceneManager.LoadScene, SceneManager.LoadSceneAsync, and EditorSceneManager.OpenScene. It extracts the first argument and checks if it matches any known scene asset in the project.
The analyzer handles different ways Unity refers to scenes:
Short name:
"MyScene"Relative path:
"Scenes/MyScene"Full Asset path:
"Assets/Scenes/MyScene.unity"
If the scene is not found in the project's asset database at all, the inspection triggers a warning.
Example
In this example, the "MissingScene" string does not match any .unity file in the project's Assets folder.