Exemplo n.º 1
0
 private void LoadSync(string scene)
 {
     try
     {
         SceneManager.LoadScene(scene);
         SceneStack.Push(scene);
     } catch (Exception ex)
     {
         log.Error(ex);
         SceneManager.LoadScene(0);
     }
     InputBlocker.Hide(this);
 }
Exemplo n.º 2
0
        private void BeginSceneLoading(string sceneName)
        {
            log.Debug("Loading Scene... {0}", sceneName);
            preCallbacks.Call(sceneName);
            preOneshotCallbacks.Call(sceneName);
            preOneshotCallbacks = null;

            if (Platform.isEditor)
            {
                LoadSync(sceneName);
            }
            else
            {
                if (BuildConfig.STREAMING_SCENE_FROM > 0 && !SceneStack.HasVisited(sceneName))
                {
                    Cdn.cache.GetAssetBundle(sceneName + FileTypeEx.ASSET_BUNDLE, false, asset => {
#if ASYNC_SCENE_LOADING
                        if (asset != null)
                        {
                            StartCoroutine(LoadAsync(sceneName, asset));
                        }
                        else
                        {
                            LoadSync(sceneName);
                        }
#else
                        LoadSync(sceneName);
#endif
                    });
                }
                else
                {
                    LoadSync(sceneName);
                }
            }
        }