implicit operator UniTask<T> -> UniTask

master
neuecc 2020-05-07 07:28:35 +09:00
parent 6be955816b
commit 84f4d8007d
2 changed files with 12 additions and 0 deletions

View File

@ -406,6 +406,11 @@ namespace Cysharp.Threading.Tasks
return new UniTask(this.source, this.token);
}
public static implicit operator UniTask(UniTask<T> self)
{
return self.AsUniTask();
}
/// <summary>
/// returns (bool IsCanceled, T Result) instead of throws OperationCanceledException.
/// </summary>

View File

@ -134,6 +134,9 @@ public class SandboxMain : MonoBehaviour
Application.logMessageReceived += Application_logMessageReceived;
UniTask<int> foo = UniTask.FromResult(10);
Foo(foo);
//ucs = new UniTaskCompletionSource();
//okButton.onClick.AddListener(async () =>
@ -156,6 +159,10 @@ public class SandboxMain : MonoBehaviour
});
}
static void Foo(UniTask t)
{
}
async UniTaskVoid Go(AsyncUpdateTrigger trigger, int i, CancellationToken ct)
{
await UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate);