using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public enum PerloadingScene { JINBIDAO, BAOSHIDAO, JINSHAKUANG, BAOSHIKUANG } public class Preloading : MonoBehaviour { public static Preloading Instance; private AsyncOperation JinshadaoSceneLoad; private AsyncOperation baoshidaoSceneLoad; // Start is called before the first frame update void Start() { Instance = this; JinshadaoSceneLoad = SceneManager.LoadSceneAsync(JumpScene.scene_jiashadao); JinshadaoSceneLoad.allowSceneActivation = false; baoshidaoSceneLoad = SceneManager.LoadSceneAsync(JumpScene.scene_baoshidao); baoshidaoSceneLoad.allowSceneActivation = false; } public void OnSceneLoaded(PerloadingScene perloading) { switch(perloading) { case PerloadingScene.JINBIDAO: JinshadaoSceneLoad.allowSceneActivation = true; break; case PerloadingScene.BAOSHIDAO: baoshidaoSceneLoad.allowSceneActivation = true; break; } } // Update is called once per frame void Update() { } }