Skip to content

Instantly share code, notes, and snippets.

@aprius
Created June 1, 2019 09:52
Show Gist options
  • Save aprius/f15d77e81e2afad85d6ef7e0bee04e28 to your computer and use it in GitHub Desktop.
Save aprius/f15d77e81e2afad85d6ef7e0bee04e28 to your computer and use it in GitHub Desktop.
//Not push first OnNext same ReactiveProperty<T>
//Debug.Log("HAHAHA : " + _); not run until Method ChangeCurrent() Call
private SubjectProperty<int> _current = new SubjectProperty<int>();
private IDisposable _disposable;
public void Start()
{
_disposable = _current.Subscribe(_ =>
{
if (_current.Value > 10)
{
_disposable.Dispose();
}
Debug.Log("HAHAHA : " + _);
_current.Value++;
});
}
[NaughtyAttributes.Button()]
public void ChangeCurrent()
{
_current.Value++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment