Example #1
0
        public void Initialize(AdditiveSceneComponent component)
        {
            if (config != null)
            {
                return;
            }

            config = Resources.Load <SceneManagerConfig>("SceneManagerConfig");
            if (config == null)
            {
                throw new Exception($"{this} Cant load scene manager config from Resources/SceneManagerConfig");
            }

            string parentSceneName = component.Config.SceneParent.Name;

            SceneConfig scene = config.Scenes.FirstOrDefault(x => x.Name.ToLowerInvariant() == parentSceneName.ToLowerInvariant());

            if (scene == null)
            {
                throw new Exception($"{this} no configuration for the current scene: {parentSceneName}");
            }

            if (scene.Async)
            {
                SceneManagement.LoadSceneAsync(scene.Name, UnityEngine.SceneManagement.LoadSceneMode.Single);
            }
            else
            {
                SceneManagement.LoadScene(scene.Name);
            }
        }
Example #2
0
        public void Initialize(SceneComponent component)
        {
            currentScene = component;
            if (config != null)
            {
                return;
            }

            config = Resources.Load <SceneManagerConfig>("SceneManagerConfig");
            if (config == null)
            {
                throw new Exception($"{this} Cant load scene manager config from Resources/SceneManagerConfig");
            }
        }