[游戏开发][Unity]Unity运行时加载不在BuildSetting里的场景

 从Assets开始路径要写全,需要.unity扩展名

如果路径写错了会报错

LoadSceneAsyncInPlayMode expects a valid full path. The provided path was 'Assets/Works/Resource/Scenes.unity

string sceneFullPath = "Assets/Works/Resource/Scenes/TestScene.unity";
LoadSceneParameters parameters = new LoadSceneParameters() { loadSceneMode = LoadSceneMode.Single, localPhysicsMode = LocalPhysicsMode.None };
AsyncOperation asyncOperation = UnityEditor.SceneManagement.EditorSceneManager.LoadSceneAsyncInPlayMode(sceneFullPath, parameters);
Scene scene = UnityEditor.SceneManagement.EditorSceneManager.LoadSceneInPlayMode(sceneFullPath, parameters);

你可能感兴趣的:(开发心得,unity,游戏引擎)