Created
August 5, 2020 08:34
-
-
Save Sythelux/4f0d97ea68318d21766ade48667ccb05 to your computer and use it in GitHub Desktop.
A CustomYieldInstruction for Unity that just wraps waiting on a task.
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
///<author email="[email protected]">Sythelux Rikd</author> | |
public class WaitOnTask : CustomYieldInstruction | |
{ | |
private Task _task; | |
private bool _taskDone; | |
public override bool keepWaiting => !_taskDone; | |
public WaitOnTask(Task task) | |
{ | |
_task = task; | |
task.ContinueWith(_ => _taskDone = true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment