Example #1
0
        IEnumerator _Setup(Starter starter)
        {
            for (var i = 0; i < SceneManager.sceneCount; i++)
            {
                var scene = SceneManager.GetSceneAt(i);

                scenes.Add(scene.name, scene);
            }

            for (var i = 0; i < sceneDependsOn.Count; i++)
            {
                var name = sceneDependsOn[i];
                if (scenes.ContainsKey(name))
                {
                    yield return(new WaitForSeconds(0.1f));

                    continue;
                }

                var load = SceneManager.LoadSceneAsync(sceneDependsOn[i], LoadSceneMode.Additive);
                while (!load.isDone)
                {
                    yield return(0);
                }

                scenes.Add(name, SceneManager.GetSceneByName(name));
            }

            if (sceneDependsOn.Count == 0)
            {
                yield return(0);
            }

            sceneLoaded();

            starter.BindScene();
        }
Example #2
0
        public void Setup(List <SceneReference> scenesToKeep, List <SceneReference> sceneDependsOn, Starter starter)
        {
            this.scenesToKeep.Clear();
            this.sceneDependsOn.Clear();

            for (var i = 0; i < scenesToKeep.Count; i++)
            {
                this.scenesToKeep.Add(scenesToKeep[i].Path);
            }

            for (var i = 0; i < sceneDependsOn.Count; i++)
            {
                this.sceneDependsOn.Add(sceneDependsOn[i].Path);
            }

            Toolbox.Instance.StartCoroutine(_Setup(starter));
        }