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.

Broken Yield and Delay (in 1.3.0+)

See original GitHub issue

I’ve updated to 1.3.1 using git/packages installation and whole project is broken. Something like:

private async void Awake()
{
    await Test(); //or Test().Forget();
}

async UniTask Test()
{
	Debug.Log( "1" );
	await UniTask.Delay(1);
	Debug.Log( "2" );
	await UniTask.Yield();
	Debug.Log( "3" );
}

Prints only “1”

Tried it in empty project and it’s fine there. Any ideas?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
TigerHixcommented, May 8, 2020

Same issue and the above solution did not solve my problem. Specifically I created an Initialization script with lowest script executing order (so it should run first) with below code:

    private async void Awake()
    {
        var playerLoop = UnityEngine.LowLevel.PlayerLoop.GetCurrentPlayerLoop();
        PlayerLoopHelper.Initialize(ref playerLoop);
        print("UniTask initializing");
        await UniTask.DelayFrame(0);
        print("UniTask initialized");
    }

Only the first print statement works.

0reactions
kamykercommented, May 8, 2020

Ye, I think Unity needs like a one frame to update its playerloop.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Yield vs Delay ? Can we call yield instead of delay when ...
First it receives data and then it do some delay. I have found yield() funtion is one when called can do backend processing...
Read more >
Change log for kotlinx.coroutines
All Kotlin dependencies updated to 1.3 release version. Fixed potential memory leak in HandlerDispatcher.scheduleResumeAfterDelay , thanks @cbeyls. yield ...
Read more >
OpenFlow Switch Specification
OpenFlow Switch Specification. Version 1.3.0. Contents. 1 Introduction. 6. 2 Switch Components. 6. 3 Glossary. 7. 4 OpenFlow Ports. 8. 4.1 OpenFlow ports...
Read more >
Kotlin 1.3 RC is Here: Migrate Your Coroutines!
It's a good time to migrate libraries using old experimental coroutines now to get them ready by the time 1.3.0 is out. Our...
Read more >
Patch 1.3.0 | Vanilla WoW Wiki - Fandom
While protected, taking damage will not cause spellcasting delays, but non-instant ... Crystal Ward, and Crystal Yield to be on appropriate cooldown timers....
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