question

Kelly Brett avatar image
Kelly Brett asked

Why don't async calls return a task?

I don't understand why Microsoft touts returning tasks for async calls but the PlayfabAPI calls are all configured to return a void. Am I missing something?

tasks
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Citrus Yan avatar image
Citrus Yan answered

We do have some SDKs that use the async pattern, for instance, the CSharpSDK and JavaSDK. Which SDK are you referring to in the question that returns void instead of a async task, is it the Unity SDK or something else? For Unity SDK, we don’t use C# async features as it’s not supported in Unity’s legacy scripting runtime and there are still lots of projects currently using it, that’s the reason why async methods are not exposed in the Unity SDK. Moreover, the Unity SDK, along with some other SDKs that return void are using a different asynchronous pattern, which is the callback pattern. In each API call, you can always find a result callback and an error callback, within which you can handle any logic you want.

For more details, please take a look at these threads:

https://community.playfab.com/questions/23363/can-not-use-loginwithcustomidasync-with-unity-2018.html

https://community.playfab.com/questions/23516/unity-sdk-vs-c-sdk.html

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.