Last active
October 31, 2019 08:25
-
-
Save Josef212/3bca64a0dcf6446ab5598e831a786809 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
using System.Threading.Tasks; | |
using UnityEngine; | |
public static class AsyncExtensions | |
{ | |
public static Task GetTask(this AsyncOperation asyncOp) | |
{ | |
TaskCompletionSource<object> tcs = new TaskCompletionSource<object>(); | |
asyncOp.completed += _ => tcs.SetResult(null); | |
return tcs.Task; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment