-
-
Notifications
You must be signed in to change notification settings - Fork 861
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #518 from Cysharp/hadashiA/awaitable-to-unitask
Add Awaitable.AsUniTask()
- Loading branch information
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAwaitableExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#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; | ||
} | ||
|
||
public static async UniTask<T> AsUniTask<T>(this UnityEngine.Awaitable<T> awaitable) | ||
{ | ||
return await awaitable; | ||
} | ||
} | ||
} | ||
#endif |
3 changes: 3 additions & 0 deletions
3
src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAwaitableExtensions.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.