Closed timcassell closed 1 year ago
@drew-512 Please take a look. I modeled this after UnityAsync
.
You can wait on an AsyncOperation
like this (cancelationToken is optional):
PromiseYielder.WaitForAsyncOperation(asyncOp).ToPromise(cancelationToken);
or
await PromiseYielder.WaitForAsyncOperation(asyncOp);
or
await PromiseYielder.WaitForAsyncOperation(asyncOp).WithCancelation(cancelationToken);
or
await PromiseYielder.WaitForAsyncOperation(asyncOp).AwaitWithProgress(0f, 1f, cancelationToken);
Love it! Plugging in the latest main
today and will be testing it via my Unity AssetBundle wrappers and will report back.
Looks like I should use the promiseyielder-updates
branch!
Looking good so far!
Will put in that latest commit this eve.
@drew-512 Great! The only change I made in the last push was using Unity's time in WaitForTime
instead of scaling a system timer.
LGTM
@drew-512 Tyvm for your feedback!
Fixes #199 and resolves #196.
Optimized
PromiseYielder.WaitOneFrame()
. (now 4x faster thanyield return null
) DeprecatedPromiseYielder.WaitOneFrame(MonoBehaviour)
. (Breaking change,WaitOneFrame()
returns a different type now) Added common Unity awaits toPromiseYielder
.