How do you pass parameter types to a "UniTask.Action"?
See original GitHub issueHow do you pass parameter types to a āUniTask.Actionā?
void OnEnable() {
_loadSceneEvent.Register(UniTask.Action(OnLoadScene)); // this doesnt work, need to use regular "async void" callback or delegate with no parameters
}
async UniTaskVoid OnLoadScene(GameScene gameScene) {
await LoadScene(gameScene);
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Cysharp/UniTask: Provides an efficient allocation ...
Tasks; // You can return type as struct UniTask<T>(or UniTask), ... They return value tuples so you can deconstruct each result and pass...
Read more >How to call async-wait method in any function by using ...
I am using UniTask in Unity 2020.3. And I want to call an async method which returns a UniTask in Unity Event Function....
Read more >UniTask, a new async/await library for Unity. - Yoshifumi Kawai
C#/Unity asynchronous processing for async/await Ā· It combines with MonoBehaviour during startup Ā· Transmits the return value Ā· TransmitsĀ ...
Read more >6ē¹/UniTask
You can pass CancellationToken to parameter by standard CancellationTokenSource . var cts = new CancellationTokenSource(); cancelButtonĀ ...
Read more >UniTaskCompletionSourceCore<TResult> Struct | UniTask
Type Parameters. TResult ... Schedules the continuation action for this operation. ... Opaque value that was provided to the UniTask's constructor.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK, I was completely overthinking this, I just need to store a reference to the action returned by my
UniTaskHelper.Action
for proper unsubscribing. I should really go to bed early š¬ I do think adding the generic overrides into UniTask would be useful, but thatās up to you. Thank you for your time.Sorry, yea I just realized I put the
Register
method in the example instead of the event