File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
Packages/com.chark.scriptable-scenes/Runtime Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -279,9 +279,22 @@ AsyncOperation StartLoadSceneOperation()
279279 var parameters = new LoadSceneParameters ( LoadSceneMode . Additive ) ;
280280
281281#if UNITY_EDITOR
282- // Allow to load scenes which are not added to Build Settings (Editor only).
283- return UnityEditor . SceneManagement . EditorSceneManager
284- . LoadSceneAsyncInPlayMode ( scenePath , parameters ) ;
282+ var buildIndex = SceneUtility . GetBuildIndexByScenePath ( scenePath ) ;
283+ if ( buildIndex < 0 )
284+ {
285+ Debug . LogWarning (
286+ $ ""
287+ + $ "Loading scene '{ scenePath } ' which is not added to build settings, make "
288+ + $ "sure to add it before making the final build or it wont load!",
289+ this
290+ ) ;
291+
292+ // Allow to load scenes which are not added to Build Settings (Editor only).
293+ return UnityEditor . SceneManagement . EditorSceneManager
294+ . LoadSceneAsyncInPlayMode ( scenePath , parameters ) ;
295+ }
296+
297+ return SceneManager . LoadSceneAsync ( scenePath , parameters ) ;
285298#else
286299 return SceneManager . LoadSceneAsync ( scenePath , parameters ) ;
287300#endif
You can’t perform that action at this time.
0 commit comments