This commit is contained in:
左右看
2023-07-12 09:27:26 +08:00
3 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -14,14 +14,15 @@ public class UmaSceneController:MonoBehaviour
if (instance) if (instance)
{ {
Destroy(gameObject); Destroy(gameObject);
return;
} }
instance = this; instance = this;
DontDestroyOnLoad(this); DontDestroyOnLoad(this);
} }
public void LoadScene(string name, Action OnSceneloaded = null, Action OnLastSceneUnloaded = null) public static void LoadScene(string name, Action OnSceneloaded = null, Action OnLastSceneUnloaded = null)
{ {
StartCoroutine(LoadLiveSceneAsync(name, OnSceneloaded, OnLastSceneUnloaded)); instance.StartCoroutine(instance.LoadLiveSceneAsync(name, OnSceneloaded, OnLastSceneUnloaded));
} }
IEnumerator LoadLiveSceneAsync(string sceneName, Action OnSceneloaded, Action OnLastSceneUnloaded) IEnumerator LoadLiveSceneAsync(string sceneName, Action OnSceneloaded, Action OnLastSceneUnloaded)
+1 -1
View File
@@ -682,7 +682,7 @@ public class UmaViewerBuilder : MonoBehaviour
GameObject.Find("AudioManager") GameObject.Find("AudioManager")
}; };
UmaSceneController.instance.LoadScene("LiveScene", UmaSceneController.LoadScene("LiveScene",
delegate () delegate ()
{ {
// Move the GameObject (you attach this in the Inspector) to the newly loaded Scene // Move the GameObject (you attach this in the Inspector) to the newly loaded Scene
@@ -502,7 +502,7 @@ namespace Gallop.Live
if (Input.GetKeyDown(KeyCode.Escape)) if (Input.GetKeyDown(KeyCode.Escape))
{ {
isExit = true; isExit = true;
UmaSceneController.instance.LoadScene("Version2"); UmaSceneController.LoadScene("Version2");
AssetBundle.UnloadAllAssetBundles(true); AssetBundle.UnloadAllAssetBundles(true);
} }