Skip to content

Instantly share code, notes, and snippets.

@Josef212
Last active October 31, 2019 08:25
Show Gist options
  • Save Josef212/3bca64a0dcf6446ab5598e831a786809 to your computer and use it in GitHub Desktop.
Save Josef212/3bca64a0dcf6446ab5598e831a786809 to your computer and use it in GitHub Desktop.
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