public static UniTask <UnityEngine.Object> ToUniTask(this AssetBundleRequest asyncOperation, IProgress <float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken)) { Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation)); if (asyncOperation.isDone) { return(UniTask.FromResult(asyncOperation.asset)); } return(new UniTask <UnityEngine.Object>(AssetBundleRequestConfiguredSource.Create(asyncOperation, timing, progress, cancellationToken, out var token), token)); }
public static UniTask <UnityEngine.Object> WithCancellation(this AssetBundleRequest asyncOperation, CancellationToken cancellationToken) { Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation)); if (asyncOperation.isDone) { return(UniTask.FromResult(asyncOperation.asset)); } return(new UniTask <UnityEngine.Object>(AssetBundleRequestConfiguredSource.Create(asyncOperation, PlayerLoopTiming.Update, null, cancellationToken, out var token), token)); }