//----- property ----- //----- method ----- void OnEnable() { instance = target as ParticlePlayer; if (!instance.IsInitialized) { Reflection.InvokePrivateMethod(instance, "Initialize"); } if (applyDisposable != null) { applyDisposable.Dispose(); } if (!Application.isPlaying) { ParticlePlayerEmulator.update -= Emulate; ParticlePlayerEmulator.update += Emulate; // Applyされたタイミングで子階層のSortingOrderを戻してから保存する. applyDisposable = PrefabApplyHook.OnApplyPrefabAsObservable().Subscribe( x => { if (instance != null && x == instance.gameObject) { Reflection.InvokePrivateMethod(instance, "RevertOriginSortingOrder"); } }) .AddTo(disposable.Disposable); } else { updateDisposable = instance .ObserveEveryValueChanged(x => x.CurrentTime) .Subscribe(x => Repaint()) .AddTo(disposable.Disposable); } }
private static void InitializeOnLoadMethod() { PrefabApplyHook.OnApplyPrefabAsObservable().Subscribe(x => OnApplyPrefab(x)); }