public static void InstantiateLoadingScreen() { // If there isn't a LoadingScreen, then create a new one if (instance == null) { instance = Instantiate(Resources.Load <GameObject>(prefabName)).GetComponent <LO_LoadingScreen>(); // Don't destroy loading screen while it's loading DontDestroyOnLoad(instance.gameObject); } // Enable loading screen instance.gameObject.SetActive(true); }
// Load a new scene public static void LoadScene(string sceneName) { // If there isn't a LoadingScreen, then create a new one instance = Instantiate(Resources.Load <GameObject>(prefabName)).GetComponent <LO_LoadingScreen>(); // Don't destroy loading screen while it's loading DontDestroyOnLoad(instance.gameObject); // Enable loading screen instance.gameObject.SetActive(true); // Start loading between scenes instance.loadingProcess = SceneManager.LoadSceneAsync(sceneName); // Don't allow scene switching instance.loadingProcess.allowSceneActivation = false; }
private void OnTriggerExit(Collider other) { if (onlyLoadWithTag == true && onTriggerExit == true) { if (other.gameObject.tag == objectTag) { LO_LoadingScreen.prefabName = prefabToLoad; LO_LoadingScreen.LoadScene(sceneName); } } else if (onTriggerExit == true) { LO_LoadingScreen.prefabName = prefabToLoad; LO_LoadingScreen.LoadScene(sceneName); } }
// Load a new scene public static void LoadScene(string sceneName) { // If there isn't a LoadingScreen, then create a new one if (instance == null) { instance = Instantiate(Resources.Load <GameObject>(prefabName)).GetComponent <LO_LoadingScreen>(); // Don't destroy loading screen while it's loading DontDestroyOnLoad(instance.gameObject); } // Enable loading screen instance.gameObject.SetActive(true); // Start loading between scenes (Background process. That's why there is an Async) instance.loadingProcess = SceneManager.LoadSceneAsync(sceneName); // Don't switch scene even after loading is completed instance.loadingProcess.allowSceneActivation = false; }
public static void LauchPreloader() { LO_LoadingScreen.prefabName = s_instance.m_PreloadPrefab; LO_LoadingScreen.LoadScene(s_instance.m_SceneToLoad); }
public void ChangeToScene(string sceneName) { LO_LoadingScreen.LoadScene(sceneName); }
public void HideScreen() { LO_LoadingScreen.HideScreen(); }
public void LoadLooader() { LO_LoadingScreen.InstantiateLoadingScreen(); }