private IEnumerator GetOneSceneLoadProgress() { //_cameraGO.SetActive(true); _loadingScreen.SetActive(true); for (int i = 0; i < _scenesLoading.Count; ++i) { while (!_scenesLoading[i].isDone) { _totalProgress = 0; foreach (AsyncOperation operation in _scenesLoading) { _totalProgress += operation.progress; } _totalProgress = (_totalProgress / _scenesLoading.Count); _progressBar.fillAmount = _totalProgress; yield return(null); } } _loadingScreen.SetActive(false); //_cameraGO.SetActive(false); SceneManager.SetActiveScene(SceneManager.GetSceneByBuildIndex(_newScene)); _scenesLoading.Clear(); //destroy loading screen? Destroy(_loadingScreen); NewSceneWasLoaded.Invoke(Scenes.MENU); }
private IEnumerator WaitForLoadUnloadScene() { for (int i = 0; i < _scenesLoading.Count; ++i) { while (!_scenesLoading[i].isDone) { yield return(null); } } SceneManager.SetActiveScene(SceneManager.GetSceneByBuildIndex(_newScene)); _scenesLoading.Clear(); NewSceneWasLoaded.Invoke((Scenes)_newScene); }