private IEnumerator transitScene(string scene, float interval) { // シーン読み込み var operation = SceneManager.LoadSceneAsync(scene); operation.allowSceneActivation = false; // フェードイン canvas.enabled = true; screen.FadeIn(interval); // ロードアニメーション screen.Play(operation); yield return(new WaitWhile(() => screen.isFading)); yield return(new WaitWhile(() => operation.progress < 0.9f)); // シーンをアクティブ化 operation.allowSceneActivation = true; yield return(new WaitUntil(() => operation.isDone)); // シーン準備完了 SceneReady?.Invoke(this, EventArgs.Empty); // フェードアウト screen.FadeOut(interval); yield return(new WaitWhile(() => screen.isFading)); screen.Stop(); canvas.enabled = false; // コルーチンの削除 coroutine = null; }
private IEnumerator Start() { asyncLoad = SceneManager.LoadSceneAsync(sceneBuildIndex); asyncLoad.allowSceneActivation = false; while (!asyncLoad.isDone) { LoadProgress = asyncLoad.progress; if (LoadProgress >= 0.9f) { SceneReady?.Invoke(); if (loadingText != null) { loadingText.gameObject.SetActive(false); } break; } yield return(null); } }
private void Start() { SceneReady?.Invoke(this, EventArgs.Empty); }