Last active
July 2, 2021 06:12
-
-
Save yKimisaki/c44f4e08d5f4c2c63f3819f27a273738 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UniRx; | |
using UnityEngine; | |
public class KyubuTest : MonoBehaviour | |
{ | |
public void Start() | |
{ | |
var rp = new ReactiveProperty<int>(1); | |
Observable.Timer(TimeSpan.FromSeconds(0.5)).Subscribe(_ => rp.Value = 2); | |
Observable.Timer(TimeSpan.FromSeconds(1.0)).Subscribe(_ => rp.Value = 3); | |
Observable.Timer(TimeSpan.FromSeconds(1.5)).Subscribe(_ => rp.Value = 4); | |
Observable.Timer(TimeSpan.FromSeconds(2.0)).Subscribe(_ => rp.Value = 5); | |
Observable.Timer(TimeSpan.FromSeconds(2.5)).Subscribe(_ => rp.Value = 6); | |
// RaiseOnNextの変更を入れたらこうなる | |
rp.Skip(2).First().Subscribe(x => | |
{ | |
Debug.Log($"v1 = {x}"); // 3 | |
rp.Skip(2).First().Subscribe(y => | |
{ | |
Debug.Log($"v2 = {y}"); // 5 | |
rp.Skip(2).First().Subscribe(x => Debug.Log($"v3 = {x}")); // こない | |
}); | |
}); | |
// 現状 | |
rp.Skip(2).First().Subscribe(x => | |
{ | |
Debug.Log($"v1 = {x}"); // 3 | |
rp.Skip(2).First().Subscribe(y => | |
{ | |
Debug.Log($"v2 = {y}"); // 4 | |
rp.Skip(2).First().Subscribe(x => Debug.Log($"v3 = {x}")); // 5 | |
}); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment