UniTask
UniTask copied to clipboard
UniTask.WhenAny
Hello, I would like to ask how can I replicate this Task.WhenAny example with UniTask? I am having trouble with this because I kept running into InvalidOperationException: Already continuation registered, can not await twice or get Status after await.
exception.
Specifically this part
int total = 0;
while (downloadTasks.Any())
{
Task<int> finishedTask = await Task.WhenAny(downloadTasks);
downloadTasks.Remove(finishedTask);
total += await finishedTask;
}
UniTask is similar as ValueTask
, does not applicable some samples of Task.
UniTask is similar as
ValueTask
, does not applicable some samples of Task.
if I want to do something similar, is there any example you can provide?
convert to Task(ToTask
).
However, it is not recommended due to the overhead.
You may want to consider a different approach.