private IObservable <Unit> Launch() { return(EditorSceneChanger.SceneChange(targetScenePath) .Do(x => { if (x) { Prefs.launch = true; Prefs.standbyInitializer = true; SuspendSceneInstance(); // 実行状態にする. // ※ 次のフレームでメモリ内容が消滅する. EditorApplication.isPlaying = true; } }) .AsUnitObservable()); }
private static void ResumeScene() { if (Application.isPlaying) { return; } if (!Prefs.launch) { return; } if (forceUpdate || CheckInterval < frameCount++) { var waitScene = EditorSceneChangerPrefs.waitScene; var lastScene = EditorSceneChangerPrefs.lastScene; if (string.IsNullOrEmpty(waitScene) && !string.IsNullOrEmpty(lastScene)) { if (disposable != null) { disposable.Dispose(); disposable = null; } disposable = EditorSceneChanger.SceneResume(() => Prefs.launch = false).Subscribe(); } // 現在のシーンから起動されたのでResumeされない. else { Prefs.launch = false; ResumeSceneInstance(); } frameCount = 0; forceUpdate = false; } }
private IObservable <Unit> Launch() { var sceneGuid = Prefs.targetSceneGuid; var scenePath = string.IsNullOrEmpty(sceneGuid) ? null : AssetDatabase.GUIDToAssetPath(sceneGuid); return(EditorSceneChanger.SceneChange(scenePath) .Do(x => { if (x) { Prefs.status = Status.ResumeScene; Prefs.standbyInitializer = true; SuspendSceneInstance(); // 実行状態にする. // ※ 次のフレームでメモリ内容が消滅する. EditorApplication.isPlaying = true; } }) .AsUnitObservable()); }
private static void ResumeScene() { // 遷移中ではない. if (EditorSceneChanger.State == SceneChangeState.None) { var currentScene = GetCurrentScenePath(); var resumeScene = EditorSceneChanger.Prefs.resumeScene; var resume = true; // 戻り先シーンがある. resume &= !string.IsNullOrEmpty(resumeScene); // 現在のシーンが戻り先のシーンではない. resume &= currentScene != resumeScene; if (resume) { if (disposable != null) { disposable.Dispose(); disposable = null; } disposable = EditorSceneChanger.SceneResume() .Subscribe(_ => Prefs.status = Status.ResumeObject); } else { ResumeSceneInstance(); Prefs.status = Status.None; } Prefs.suspendObjectNames = new string[0]; } }