From 79cd2c17ba7cd4f11d0cf1fc5477942cc61122c2 Mon Sep 17 00:00:00 2001 From: Yoshifumi Kawai Date: Mon, 7 Sep 2020 18:55:44 +0900 Subject: [PATCH 1/4] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 55db857..3d56794 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,8 @@ Provides an efficient allocation free async/await integration to Unity. * Highly compatible behaviour with Task/ValueTask/IValueTaskSource Techinical details, see blog post: [UniTask v2 — Zero Allocation async/await for Unity, with Asynchronous LINQ -](https://medium.com/@neuecc/unitask-v2-zero-allocation-async-await-for-unity-with-asynchronous-linq-1aa9c96aa7dd) +](https://medium.com/@neuecc/unitask-v2-zero-allocation-async-await-for-unity-with-asynchronous-linq-1aa9c96aa7dd) +Advanced tips, see blog post: [Extends UnityWebRequest via async decorator pattern — Advanced Techniques of UniTask](https://medium.com/@neuecc/extends-unitywebrequest-via-async-decorator-pattern-advanced-techniques-of-unitask-ceff9c5ee846) From 87dd5f13fd218428f46e284788018226bb1ee2d4 Mon Sep 17 00:00:00 2001 From: hikari Date: Wed, 9 Sep 2020 14:05:37 +0900 Subject: [PATCH 2/4] [Unwrap()] fix: remove type parameter --- .../Assets/Plugins/UniTask/Runtime/UniTaskExtensions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskExtensions.cs b/src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskExtensions.cs index 2acb110..27dea17 100644 --- a/src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskExtensions.cs +++ b/src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskExtensions.cs @@ -732,7 +732,7 @@ namespace Cysharp.Threading.Tasks return await await task; } - public static async UniTask Unwrap(this UniTask task) + public static async UniTask Unwrap(this UniTask task) { await await task; } @@ -742,7 +742,7 @@ namespace Cysharp.Threading.Tasks return await await task; } - public static async UniTask Unwrap(this Task task) + public static async UniTask Unwrap(this Task task) { await await task; } @@ -752,7 +752,7 @@ namespace Cysharp.Threading.Tasks return await await task; } - public static async UniTask Unwrap(this UniTask task) + public static async UniTask Unwrap(this UniTask task) { await await task; } From 65622b01f6bcbe79d0f0c4df62c3a76066d5fa5a Mon Sep 17 00:00:00 2001 From: hikari Date: Wed, 9 Sep 2020 14:15:03 +0900 Subject: [PATCH 3/4] [Unwrap] add ConfigureAwait --- .../UniTask/Runtime/UniTaskExtensions.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskExtensions.cs b/src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskExtensions.cs index 27dea17..8664f03 100644 --- a/src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskExtensions.cs +++ b/src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskExtensions.cs @@ -741,22 +741,42 @@ namespace Cysharp.Threading.Tasks { return await await task; } + + public static async UniTask Unwrap(this Task> task, bool continueOnCapturedContext) + { + return await await task.ConfigureAwait(continueOnCapturedContext); + } public static async UniTask Unwrap(this Task task) { await await task; } + + public static async UniTask Unwrap(this Task task, bool continueOnCapturedContext) + { + await await task.ConfigureAwait(continueOnCapturedContext); + } public static async UniTask Unwrap(this UniTask> task) { return await await task; } + + public static async UniTask Unwrap(this UniTask> task, bool continueOnCapturedContext) + { + return await (await task).ConfigureAwait(continueOnCapturedContext); + } public static async UniTask Unwrap(this UniTask task) { await await task; } + public static async UniTask Unwrap(this UniTask task, bool continueOnCapturedContext) + { + await (await task).ConfigureAwait(continueOnCapturedContext); + } + #if UNITY_2018_3_OR_NEWER sealed class ToCoroutineEnumerator : IEnumerator From 81b4fcfac19362b03dfcdc651bf9114028091097 Mon Sep 17 00:00:00 2001 From: c0nd3v <32241825+c0nd3v@users.noreply.github.com> Date: Fri, 11 Sep 2020 10:41:41 -0400 Subject: [PATCH 4/4] Fixed AwaitForAllAssets() --- .../UnityAsyncExtensions.AssetBundleRequestAllAssets.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.AssetBundleRequestAllAssets.cs b/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.AssetBundleRequestAllAssets.cs index 3a19a47..9ff4ffa 100644 --- a/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.AssetBundleRequestAllAssets.cs +++ b/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.AssetBundleRequestAllAssets.cs @@ -46,6 +46,11 @@ namespace Cysharp.Threading.Tasks this.continuationAction = null; } + public AssetBundleRequestAllAssetsAwaiter GetAwaiter() + { + return this; + } + public bool IsCompleted => asyncOperation.isDone; public UnityEngine.Object[] GetResult()