mirror of
https://github.com/Cysharp/UniTask.git
synced 2026-05-20 22:50:16 +00:00
implicit operator UniTask<T> -> UniTask
This commit is contained in:
@@ -406,6 +406,11 @@ namespace Cysharp.Threading.Tasks
|
|||||||
return new UniTask(this.source, this.token);
|
return new UniTask(this.source, this.token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static implicit operator UniTask(UniTask<T> self)
|
||||||
|
{
|
||||||
|
return self.AsUniTask();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// returns (bool IsCanceled, T Result) instead of throws OperationCanceledException.
|
/// returns (bool IsCanceled, T Result) instead of throws OperationCanceledException.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -134,6 +134,9 @@ public class SandboxMain : MonoBehaviour
|
|||||||
Application.logMessageReceived += Application_logMessageReceived;
|
Application.logMessageReceived += Application_logMessageReceived;
|
||||||
|
|
||||||
|
|
||||||
|
UniTask<int> foo = UniTask.FromResult(10);
|
||||||
|
Foo(foo);
|
||||||
|
|
||||||
//ucs = new UniTaskCompletionSource();
|
//ucs = new UniTaskCompletionSource();
|
||||||
|
|
||||||
//okButton.onClick.AddListener(async () =>
|
//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)
|
async UniTaskVoid Go(AsyncUpdateTrigger trigger, int i, CancellationToken ct)
|
||||||
{
|
{
|
||||||
await UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate);
|
await UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate);
|
||||||
|
|||||||
Reference in New Issue
Block a user