예제 #1
0
        private IEnumerator LoadingSceneCoroutine(SceneLoadingOperationHandle handle, ISceneLoadingProcess process = null)
        {
            if (process == null)
            {
                process = new SceneLoadingProcessBase();
            }
            handle.onCompleted += ClearCoroutine;

            yield return(process.PreLoadingProcess());

            handle.StartLoading();

            process.OnLoadingStarted();

            float progress = -1;

            while (!handle.IsDone)
            {
                float p = handle.Progress;
                if (p != progress)
                {
                    process.OnProgressChanged(p);
                    progress = p;
                }
                yield return(null);
            }

            process.OnLoadingCompleted();
        }
예제 #2
0
        public SceneLoadingOperationHandle LoadScenesAsync(List <string> builtinSceneNames, List <object> addressableSceneKeys, LoadSceneMode loadMode = LoadSceneMode.Single, List <object> extraAssetKeys = null, ISceneLoadingProcess process = null)
        {
            if (loadSceneCoroutine != null)
            {
                Debug.LogError("Can not have load scene calls while one is running. Wait until it is done, or use LoadScenesAsync to load all together instead");
                return(null);
            }
            SceneLoadingOperationHandle handle = new SceneLoadingOperationHandle(builtinSceneNames, addressableSceneKeys, extraAssetKeys, loadMode);

            loadSceneCoroutine = StartCoroutine(LoadingSceneCoroutine(handle, process));
            return(handle);
        }
예제 #3
0
 protected void ClearCoroutine(SceneLoadingOperationHandle handle)
 {
     loadSceneCoroutine = null;
 }