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

UniTask integration #100

Merged
merged 10 commits into from
Jan 31, 2021
Merged

UniTask integration #100

merged 10 commits into from
Jan 31, 2021

Conversation

hadashiA
Copy link
Owner

@hadashiA hadashiA commented Jan 29, 2021

Add IAsyncStartable

class FooController : IAsyncStartable
{
    public UniTask StartAsync(CancellationToken cancellation)
    {
        // ...
        await UniTask.Yield(PlayerLoopTiming.Update, cancellation);
        // ...
    }
}
builder.RegisterEntryPoint<FooController>(Lifetime.Scoped);

Why is there only one interface ?

UniTask can switch the execution of the async method at any time.
So I don't think we need a lot of interfaces to choose the timing.

e.g.

await UniTask.Yield(PlayerLoopTiming.LastFixedUpdate); // etc

Is there a way to handle the error?

On the application side, we cannot write try / catch outside of Start()
Usually, we use default unobserved exception behaviour.

Or, we can use:

UniTaskScheduler.UnobservedTaskException += ex => ...

I added the following to do this for each LifetimeScope .

builder.RegisterEntryPointExceptionHandler(ex => ...);

Also use:

builder.UseEntryPoint(Lifetime.Scoped, entryPoints =>
{
    entryPoints.Add<FooController>();
    entryPoints.OnException(ex => ...);
});

How to use CancellationToken ?

TODO

  • (docs)
  • All test passes

@vercel
Copy link

vercel bot commented Jan 29, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/hadashia/vcontainer/houuf30ot
✅ Preview: https://vcontainer-git-ku-unitask-integration.hadashia.vercel.app

@github-actions

This comment has been minimized.

2 similar comments
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions
Copy link
Contributor

Unit Test Results

0 files  0 suites   0s ⏱️
0 tests 0 ✔️ 0 💤 0 ❌

Results for commit 6dc4e2e.

@hadashiA hadashiA merged commit a453e72 into master Jan 31, 2021
@hadashiA hadashiA deleted the ku/unitask-integration branch January 31, 2021 08:55
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

Successfully merging this pull request may close these issues.

1 participant