Esempio n. 1
0
        public LoadSceneAsyncWaitHandle LoadSceneAsync(string sceneName, LoadSceneMode mode = LoadSceneMode.Single)
        {
            var handle = new LoadSceneAsyncWaitHandle();

            this.OnBeforeSceneLoaded(sceneName, mode, handle);
            var op = SceneManager.LoadSceneAsync(sceneName, mode);

            handle.Init(op, SceneManager.GetSceneAt(SceneManager.sceneCount - 1));
            return(handle);
        }
Esempio n. 2
0
        public LoadSceneAsyncWaitHandle LoadSceneAsync(int sceneBuildIndex, LoadSceneMode mode = LoadSceneMode.Single)
        {
            if (sceneBuildIndex < 0 || sceneBuildIndex >= SceneManager.sceneCountInBuildSettings)
            {
                throw new System.IndexOutOfRangeException("sceneBuildIndex");
            }

            var handle = new LoadSceneAsyncWaitHandle();

            this.OnBeforeSceneLoaded("#" + sceneBuildIndex.ToString(), mode, handle);
            var op = SceneManager.LoadSceneAsync(sceneBuildIndex, mode);

            handle.Init(op, SceneManager.GetSceneAt(SceneManager.sceneCount - 1));
            return(handle);
        }