Beispiel #1
0
    public void LoadAppScene(Utility.App app, string sceneName)
    {
        SceneLoadObject sceneLoadObject = new SceneLoadObject(app, sceneName);

        m_sceneToLoad.Enqueue(sceneLoadObject);
        if (m_loadSceneCoroutine == null)
        {
            m_loadSceneCoroutine = StartCoroutine(sceneLoading());
        }
    }
    IEnumerator LoadingSceneLoad(eSceneName prvSceneName, eSceneName nextScene)
    {
        //로드할 오브젝트가 있는 씬마다 있는 로드객체 클래스
        SceneLoadObject loadObj = GetNextSceneLoadObject(nextScene);

        //로딩씬에서 모든 로드를 진행한다.
        yield return(SceneManager.LoadSceneAsync(eSceneName.Loading.ToString(), LoadSceneMode.Additive));

        //동적 타입으로 지정된 에셋번들을 언로드 처리
        AssetBundleManager.Instance.DynamicBundleUnload();
        //이전 씬 언로드
        yield return(SceneManager.UnloadSceneAsync(prvSceneName.ToString()));

        yield return(loadObj != null?loadObj.CorouctineLoadPrefab() : null);

        //로딩 게이지 업데이트
        ProgressUpdate(0.5f);


        SceneManager.sceneLoaded += OnSceneLoaded;
        AsyncOperation nextSceneOper = SceneManager.LoadSceneAsync(nextScene.ToString(), LoadSceneMode.Additive);

        //진행도 업데이트
        while (nextSceneOper.isDone != true)
        {
            yield return(waitSec);

            ProgressUpdate(0.5f + (nextSceneOper.progress * 0.5f));
        }

        yield return(SceneManager.UnloadSceneAsync(eSceneName.Loading.ToString()));


        yield return(new WaitForSeconds(0.5f));;

        if (_isSceneLoadComplete)
        {
            OnLoadingComplete?.Invoke();
            StopAllCoroutines();
        }
    }