浏览代码

EditorInitialisationLoader now works with menu and locations

/main
Amel Negra 4 年前
当前提交
072ede02
共有 1 个文件被更改,包括 13 次插入8 次删除
  1. 21
      UOP1_Project/Assets/Scripts/SceneManagement/EditorInitialisationLoader.cs

21
UOP1_Project/Assets/Scripts/SceneManagement/EditorInitialisationLoader.cs


using UnityEngine.SceneManagement;
/// <summary>
/// This script loads the initial Scene, to allow to start the game from any gameplay Scene
/// This script loads the persistent managers and gameplay Scenes, to allow to start the game from any gameplay Scene
/// It can also be used for menu scene by just adding the persistent managers scene on the inspector
public GameSceneSO initializationScene;
public GameSceneSO[] persistentScenes;
private void Awake()
private void Start()
{
Application.targetFrameRate = targetFramerate; // For debugging purposes

if (scene.path == initializationScene.scenePath)
{
return;
}
for (int j = 0; j < persistentScenes.Length; ++j)
if (scene.path == persistentScenes[j].scenePath)
{
return;
}
else
{
SceneManager.LoadSceneAsync(persistentScenes[j].scenePath, LoadSceneMode.Additive);
}
SceneManager.LoadSceneAsync(initializationScene.scenePath, LoadSceneMode.Additive);
}
#endif
}
正在加载...
取消
保存