facebook twitter hatena line email

Unity/UniRx/ライフタイムイベント取得

提供: 初心者エンジニアの簡易メモ
2021年11月11日 (木) 04:09時点におけるAdmin (トーク | 投稿記録)による版

(差分) ←前の版 | 最新版 (差分) | 次の版→ (差分)
移動: 案内検索
using UniRx;
using UniRx.Triggers;
public class InputKeyScene : MonoBehaviour
{
    void Awake()
    {
        this.OnEnableAsObservable()
            .Subscribe(_ => Debug.Log("Enable!"))
            .AddTo(this);

        this.UpdateAsObservable()
            .Subscribe(_ => Debug.Log("Update!"))
            .AddTo(this);

        this.OnDisableAsObservable()
            .Subscribe(_ => Debug.Log("Disable!"))
            .AddTo(this);

        this.OnDestroyAsObservable()
            .Subscribe(_ => Debug.Log("Destroy!"))
            .AddTo(this);
    }
}
Enableだけ、なぜかログが残らない。実行されてない?