IEnumerator LoadAsyncGameScene(Enums.GameScene pScene) { sceneName = pScene; asyncLoadedScene = SceneManager.LoadSceneAsync(sceneName.ToString(), LoadSceneMode.Single); asyncLoadedScene.allowSceneActivation = false; checkSceneLoad = true; yield return(asyncLoadedScene); }
void Update() { if (checkSceneLoad) { bool loadNextScene = true; if (param != null) { param.progress = asyncLoadedScene.progress; loadNextScene = param.complete; } if (asyncLoadedScene.progress >= 0.9f && !asyncLoadedScene.allowSceneActivation && loadNextScene) { asyncLoadedScene.allowSceneActivation = true; } if (asyncLoadedScene.isDone) { checkSceneLoad = false; Scene scene1 = SceneManager.GetSceneByName(sceneName.ToString()); bool activar = SceneManager.SetActiveScene(scene1); } } }