question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UniTask.Delay results in "Pending" status forever

See original GitHub issue

I’m trying to use “await UniTask.Delay”, but every time that line gets executed, the UniTask Tracker lists two new entries with status pending (“UniTask.DelayPromise” and “UniTask.CompletionSource”).

private void startMethod()
    {
        StartCoroutine(UniTask.ToCoroutine(asyncMethod));
    }

private async UniTask asyncMethod()
    {
        //do something
        await UniTask.Delay(5000);
        //do something
    }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
neuecccommented, Aug 6, 2020

UniTask already uses GetCurrentPlayerLoop but ECS does not(uses GetDefaultPlayerLoop). You should complain to ECS.

1reaction
Nyankoocommented, Apr 21, 2020

@neuecc I’m not using ECS in my project, but the following fixed the issue:

var playerLoop = UnityEngine.LowLevel.PlayerLoop.GetCurrentPlayerLoop();
PlayerLoopHelper.Initialize(ref playerLoop);

I checked my current 2019.2 assets/plugins vs. my new 2019.3 ones, and there’re no major differences in assets/plugins, so it somehow looks like it is a 2019.3 issue in combination with “something”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Synchronously waiting for an async operation, and ...
Unfortunately, code using Wait (or Result ) will block a thread in that context, so the async method cannot complete.
Read more >
Async methods continue to execute when you stop the ...
Delay just does a normal Task.Delay and if we are not in play mode after that it awaits a forever-pending task
Read more >
UniTask v2 — Zero Allocation async/await for Unity, with ...
As a limitation, all UniTask objects cannot await twice, as they automatically return to the pool when the await completes. This constraint is ......
Read more >
COMBATING ACID VIOLENCE IN BANGLADESH, INDIA, ...
Such delays tend to hurt prosecutions' cases, as victims and witnesses lose interest and as physical evidence deteriorates or disappears.291.
Read more >
Napanee Beaver June 25 2015
The predictable result will be a continuation of the horrible divide in our community and on council. We do not deserve this in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found