Exemplo n.º 1
0
 public static UniTask ToUniTask(this AsyncOperation asyncOperation, IProgress <float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
 {
     Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));
     if (asyncOperation.isDone)
     {
         return(UniTask.CompletedTask);
     }
     return(new UniTask(AsyncOperationConfiguredSource.Create(asyncOperation, timing, progress, cancellationToken, out var token), token));
 }
Exemplo n.º 2
0
 public static UniTask WithCancellation(this AsyncOperation asyncOperation, CancellationToken cancellationToken)
 {
     Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));
     if (asyncOperation.isDone)
     {
         return(UniTask.CompletedTask);
     }
     return(new UniTask(AsyncOperationConfiguredSource.Create(asyncOperation, PlayerLoopTiming.Update, null, cancellationToken, out var token), token));
 }