Closed guidodelphora closed 2 months ago
You can use Interval().Index()
.
Ok great thanks ! It works but now I see a problem with the Timer. Maybe I'm wrong and I can't check right away how I did it with UniRx, but with this code I would expect to have a 5 seconds timer, with an OnNext every 1 second. But what is happening is that the 5 is a delay, and then it starts printing every 1 second.
Observable.Timer(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(1))
.Index()
.Subscribe(number => Debug.Log("timer" + number) );
Timer should behave the same as UniRx, the first argument is the delay until the first time, the second argument is the delay for subsequent iterations. If you want to make the whole process last 5 seconds, you can combine Interval and Take(TimeSpan).
Oh okok. So probably I had an extension method for doing this, of UniRx, because in my previous company we did this in a different way.
So yeah thanks and sorry for the misunderstanding
In UniRx we could do something like this which would give us the time of the interval
I'm doing exactly the same with R3 and the Interval returns a Unit, is this the expected behaviour?
Thanks !