Awaitable.WaitForSecondsAsync

Declaration

public static Awaitable WaitForSecondsAsync(float seconds, CancellationToken cancellationToken);

Parameters

seconds Seconds to wait for.
cancellationToken Optional cancellation token.

Description

Resumes execution after the specified number of seconds.

Note: This method can only be called from the main thread and always completes on main thread.

async Awaitable Foo(){
  await Awaitable.WaitForSecondsAsync(2);
  // Do something
  await Awaitable.WaitForSecondsAsync(2);
  // Do something else
}

Did you find this page useful? Please give it a rating: