using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class Transition_Controller : MonoBehaviour { public void StartLoadingScene(string scene) { StartCoroutine(LoadScene(scene)); } IEnumerator LoadScene(string sceneName) { yield return new WaitForSecondsRealtime(.6f); AsyncOperation sceneLoading = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive); sceneLoading.completed += (asyncOperation) => { GetComponent().SetBool("loaded", true); }; yield break; } public void DeactivateScene() { SceneManager.UnloadSceneAsync("Transition", UnloadSceneOptions.UnloadAllEmbeddedSceneObjects); } }