Is there a way to SKIP the first execution of operators in unirx?

Viewed 30

What we want to do

In the click event

  • The first time, the value will be sent without a wait time.
  • For the second action, the value is passed on one second after the event has settled down.

Problems

I was thinking that the following code could be used to achieve this if the Throttle process could be skipped only at the beginning.

GameObject button;
bool first = true;

button.onClick
      .AsObservable()
      .Throttle(TimeSpan.FromMillseconds(1000))
      .Subscribe(() => {// action});
}
0 Answers
Related