Skip to content

Instantly share code, notes, and snippets.

@hacha
Created July 7, 2015 09:23
Show Gist options
  • Save hacha/8bfb174f9722492a83d1 to your computer and use it in GitHub Desktop.
Save hacha/8bfb174f9722492a83d1 to your computer and use it in GitHub Desktop.
こういうコンポーネントを持つオブジェクトを、ストリーム発火前にDestoryするとUniRx内でInvalidOperationExceptionが発生するっぽい
using UnityEngine;
using System.Collections;
using UniRx;
using UniRx.Triggers;
public class Test : MonoBehaviour
{
void Start ()
{
var key = this.UpdateAsObservable()
.Where(_ => Input.GetKeyDown(KeyCode.A))
.First()
.Subscribe(_ => Debug.Log("test"));
}
}
@kenji-andoh
Copy link

First() は空のストリームではエラーだ、空かどうかが判明するのは OnComplete() のときだ。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment