IEnumerator EndGameCoroutine(float startDelay) { yield return(new WaitForSeconds(startDelay)); _winPopup.gameObject.SetActive(false); _loadingScreen.gameObject.SetActive(true); canvas.gameObject.SetActive(false); var asyncOp = SceneManager.LoadSceneAsync("EndgameScreen", LoadSceneMode.Single); asyncOp.allowSceneActivation = false; yield return(new WaitForSeconds(2f)); while (!asyncOp.isDone) { if (asyncOp.progress >= 0.9f) { _loadingScreen.OnLoadEnd(); if (Input.anyKey || AnyButtonHandler.AnyButtonPressed()) { asyncOp.allowSceneActivation = true; } } yield return(new WaitForEndOfFrame()); } }
IEnumerator StartGameCoroutine() { _loadingScreen.gameObject.SetActive(true); canvas.gameObject.SetActive(false); _loading = true; var asyncOp = SceneManager.LoadSceneAsync(stages[selectedIndex].stageScene.handle, LoadSceneMode.Single); asyncOp.allowSceneActivation = false; yield return(new WaitForSeconds(2f)); while (!asyncOp.isDone) { if (asyncOp.progress >= 0.9f) { _loadingScreen.OnLoadEnd(); if (Input.anyKey || AnyButtonHandler.AnyButtonPressed()) { asyncOp.allowSceneActivation = true; } } yield return(new WaitForEndOfFrame()); } }