Example #1
0
 private void SceneManager_SceneUnloaded(Scene scene)
 {
     if (currentExampleScene.HasValue && scene.buildIndex == currentExampleScene.Value.buildIndex)
     {
         // The currently loaded example was unloaded. Return to example selection.
         currentExampleScene = null;
         ExamplesUI.SetActive(true);
     }
 }
Example #2
0
        private void SceneManager_SceneLoaded(Scene scene, LoadSceneMode mode)
        {
            if (scene.buildIndex == 0)
            {
                // We don't care for the base scene loading. The base scene will always load
                // first when the application launches.
                return;
            }

            Assert.IsTrue(mode == LoadSceneMode.Additive, $"Only {nameof(LoadSceneMode.Additive)} scene loading is allowed!");
            currentExampleScene = scene;

            // While we have an exmaple scene loaded we want the examples selection to disappear.
            ExamplesUI.SetActive(false);
        }
Example #3
0
 /// <inheritdoc />
 public void LoadExample(ExampleProfile example)
 {
     ExamplesUI.SetActive(false);
     SceneManager.LoadSceneAsync(example.SceneName, LoadSceneMode.Additive);
 }