Skip to content

Instantly share code, notes, and snippets.

@Rosthouse
Created May 16, 2019 09:20
Show Gist options
  • Save Rosthouse/c58048def0b4915d752d83f46e0e1666 to your computer and use it in GitHub Desktop.
Save Rosthouse/c58048def0b4915d752d83f46e0e1666 to your computer and use it in GitHub Desktop.
WaitForTaskCompletion
using System.Threading.Tasks;
using UnityEngine;
public class WaitForTaskCompletion : CustomYieldInstruction
{
private Task task;
public override bool keepWaiting
{
get
{
var finished = task.IsCompleted | task.IsCanceled;
return !finished;
}
}
public WaitForTaskCompletion(Task task)
{
this.task = task;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment