You will no longer insert the wrong scene name when typing it in the string field. In addition, you can decide to load a scene using the Path
, Name
or Build Index
without worrying about changes that can be made to the selected scene.
What this allows you to do:
- Select scenes from any project folder and serialize the information in the Unity inspector;
- Stores the
Path
,Name
andBuild Index
informations from selected scene; - Keeps your selected scene's
Build Index
updated if you change the order of scenes in the build settings; - Keeps your selected scene's
Path
updated if you change the scene's folder
Create a SceneInspector
variable:
[SerializeField]
private SceneInspector _scene = null;
Configure the scene in the inspetor:
Choose which scene info you will use to load the scene:
SceneManager.LoadSceneAsync(_scene.BuildIndex);
//or
SceneManager.LoadSceneAsync(_scene.Name);
//or
SceneManager.LoadSceneAsync(_scene.Path);