public static UnityCoroutineScheduler <AssetBundle> GetAwaiter(this AssetBundleCreateRequest request) { var awaiter = new UnityCoroutineScheduler <AssetBundle>(); UnitySchedulerProvider.RunOnUnityScheduler(() => CoroutinePerformer.Instance.StartCoroutine(AssetBundleCreateRequest(awaiter, request))); return(awaiter); }
static UnityCoroutineScheduler GetVoidAwaiter(object instruction) { var awaiter = new UnityCoroutineScheduler(); UnitySchedulerProvider.RunOnUnityScheduler(() => CoroutinePerformer.Instance.StartCoroutine(ReturnVoid(awaiter, instruction))); return(awaiter); }
public static UnityCoroutineScheduler <Object> GetAwaiter(this ResourceRequest request) { var awaiter = new UnityCoroutineScheduler <Object>(); UnitySchedulerProvider.RunOnUnityScheduler(() => CoroutinePerformer.Instance.StartCoroutine(ResourceRequest(awaiter, request))); return(awaiter); }
static IEnumerator ReturnVoid(UnityCoroutineScheduler awaiter, object instruction) { yield return(instruction); awaiter.Complete(null); }
static IEnumerator ResourceRequest(UnityCoroutineScheduler <Object> scheduler, ResourceRequest request) { yield return(request); scheduler.Complete(request.asset, null); }
static IEnumerator AssetBundleCreateRequest(UnityCoroutineScheduler <AssetBundle> scheduler, AssetBundleCreateRequest request) { yield return(request); scheduler.Complete(request.assetBundle, null); }