public IEnumerator LoadAsyncScene(int sceneIndex) { if (!SceneManager.GetSceneByBuildIndex(sceneIndex).isLoaded) { Expedition.BiomeTransition(sceneIndex); Expedition.UserInterface.loadingIndicator.SetActive(true); loaderIsRunning = true; AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneIndex, LoadSceneMode.Additive); asyncLoad.completed += (asyncOperation) => { loaderIsRunning = false; Expedition.UserInterface.loadingIndicator.SetActive(false); try { SceneManager.SetActiveScene(SceneManager.GetSceneByBuildIndex(sceneIndex)); if (emergency) { Expedition.Player.gameObject.transform.position = aihf; Expedition.EnterTitleScreenState(); } } catch (Exception e) { Debug.LogException(e); } if (!_isA) { _ACollider.isTrigger = true; } else { _BCollider.isTrigger = true; } }; if (!asyncLoad.isDone) { loaderIsRunning = true; yield return(null); } } else { Debug.Log("Scene '" + sceneIndex + "' is already loaded!"); } }