Ejemplo 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));
 }
Ejemplo 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));
 }