From a4be8f316e03da56f7d2f3024bffdd063a81bc97 Mon Sep 17 00:00:00 2001 From: hadashiA Date: Thu, 2 Nov 2023 12:35:05 +0900 Subject: [PATCH] Add Awaitable.AsUniTask() --- .../UniTask/Runtime/UnityAwaitableExtensions.cs | 12 ++++++++++++ .../UniTask/Runtime/UnityAwaitableExtensions.cs.meta | 3 +++ 2 files changed, 15 insertions(+) create mode 100644 src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAwaitableExtensions.cs create mode 100644 src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAwaitableExtensions.cs.meta diff --git a/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAwaitableExtensions.cs b/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAwaitableExtensions.cs new file mode 100644 index 0000000..6045e13 --- /dev/null +++ b/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAwaitableExtensions.cs @@ -0,0 +1,12 @@ +#if UNITY_2023_1_OR_NEWER +namespace Cysharp.Threading.Tasks +{ + public static class UnityAwaitableExtensions + { + public static async UniTask AsUniTask(this UnityEngine.Awaitable awaitable) + { + await awaitable; + } + } +} +#endif diff --git a/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAwaitableExtensions.cs.meta b/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAwaitableExtensions.cs.meta new file mode 100644 index 0000000..08752a4 --- /dev/null +++ b/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAwaitableExtensions.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c29533c9e4284dee914b71a6579ea274 +timeCreated: 1698895807 \ No newline at end of file