Created
May 16, 2019 09:20
-
-
Save Rosthouse/c58048def0b4915d752d83f46e0e1666 to your computer and use it in GitHub Desktop.
WaitForTaskCompletion
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
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