12345678910111213141516171819 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Runtime.CompilerServices;
- using System.Threading.Tasks;
- using UnityEngine;
- namespace TModule.Runtime
- {
- public static class ExtensionAsyncOperation
- {
- public static TaskAwaiter GetAwaiter(this AsyncOperation asyncOp)
- {
- var tcs = new TaskCompletionSource<object>();
- asyncOp.completed += obj => { tcs.SetResult(null); };
- return ((Task)tcs.Task).GetAwaiter();
- }
- }
- }
|