question

MoonHeonYoung avatar image
MoonHeonYoung asked

cloudcode question

In the Unity C# client, for example, when there are two client api calls, if one api call have to rely on another call, i have to write another call code in the result action scope.

But does cloud code not have to take that into account?

For example, in the following screenshot,

if Unity playfabClientAPI.GetUserReadOnlyData( new obejct{}, result =>{ //// this line ////}, null);

Don't cloudcode need a scope like above?

(Time to wait for the result of the previous line's api call or bracket scope)

In other words, can I use the result of api call right away?

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

·
Sarah Zhang avatar image
Sarah Zhang answered

CloudScript functions still need to wait for a while to get the API response. But you don’t need to write the callback functions, because PlayFab have wrapped it for you. So, when you get the variable “GetUserReadOnlyDataResponse”, the response’s waiting has ended. You can use the result in the next line immediately.

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.