Cysharp/UniTask

Is there any way to await a method without cache the statemachine?

lightjiao opened this issue · 2 comments

Some initial async operation when app start run only once, I want these statemachine don't cached.

I know TaskPool.SetMaxPoolSize, but it set for all kind of Statemachine and UniTask
and the Statemachine type is compile generate, it is hard to write a custom function set there pool size

So, is there any way to await a method without cache the statemachine? Like a new Task named UniTaskNoCache ?

Maybe Task can solve my problem?
But I worry about the exception in Task, it's not safe than UniTask

Hi, Currently, there seems to be no way to do that.

By the way, in the case of .NET ValueTask, it is controlled by adding [AsyncMehodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder)] to the async method that they want to pool instead of pooling by default.
In UniTask, it would be good to be able to change the AsyncMethodBuilder for each method instead of increasing the Task type. Currently, however, C# 10 is not available in Unity, and therefore AsyncMethodBuilder cannot be attached to a method.
If this is supported, we would consider adding the feature...