Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide compiler define for UniTask library to replace use of Task #126

Closed
Soren025 opened this issue Oct 3, 2022 · 2 comments
Closed

Comments

@Soren025
Copy link

Soren025 commented Oct 3, 2022

Library in question: https://github.com/Cysharp/UniTask

The main reason I suggest this is due to how native C# tasks continue to execute in the editor even after you exit play mode. The UniTask library implements tasks to run against the Unity update loop meaning tasks will be ignored once you exit play mode.

You can experience what I am referring to by executing a HTTPRequest using WaitForResponseAsync on an endpoint you know will take a few seconds and then exit play mode.

Or just run this in the editor...

public class Test : MonoBehaviour
{
    private void Start()
    {
        Run();
        Application.Quit();
    }
    
    private async void Run()
    {
        await Task.Delay(5000);
        Debug.Log("Stuff happened outside play mode");
    }
}
@isaac-mcfadyen
Copy link

+1, this would be great especially since UniTasks are actually lighter than regular Tasks

Benedicht pushed a commit to Benedicht/com.tivadar.best.documentation that referenced this issue Oct 28, 2023
@Benedicht
Copy link
Owner

Added to v3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants