UniVRM/Assets/UniGLTF/Runtime/Extensions/TaskExtensions.cs
2021-02-12 21:48:47 +09:00

22 lines
417 B
C#

using System.Collections;
using System.Threading.Tasks;
namespace UniGLTF
{
public static class TaskExtensions
{
public static IEnumerator AsIEnumerator(this Task task)
{
while (!task.IsCompleted)
{
yield return null;
}
if (task.IsFaulted)
{
throw task.Exception;
}
}
}
}