using System; // require keep for Windows Universal App using UnityEngine; namespace UniRx.Triggers { [DisallowMultipleComponent] public class ObservableUpdateTrigger : ObservableTriggerBase { Subject update; /// Update is called every frame, if the MonoBehaviour is enabled. void Update() { if (update != null) update.OnNext(Unit.Default); } /// Update is called every frame, if the MonoBehaviour is enabled. public IObservable UpdateAsObservable() { return update ?? (update = new Subject()); } protected override void RaiseOnCompletedOnDestroy() { if (update != null) { update.OnCompleted(); } } } }