question

Unnamed Studio avatar image
Unnamed Studio asked

Cloud Script return value

Hi,

I'm new to PlayFab, and I'm using Unity 5.
How to return value to Unity after call server.GetLeaderboard ?
Thanks.

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

·
brendan avatar image
brendan answered

First, Server API calls should only ever be used from a server - either your own, or in Cloud Script, as you must use the Secret Key for your game to make these calls (and you should never ship that with your game).

When you call GetLeaderboard (whether from the Server or Client API), the response contains the leaderboard info. You can see examples of API calls and responses in our GitHub samples.

The basic Cloud Script sample is automatically Revision 1 in your Server->Cloud Script settings for all new titles, but you can also find it here: https://github.com/PlayFab/CloudScriptSamples/blob/master/BasicSample/basic_sample.js.

A Unity C# sample showing how to use leaderboards (and many other features) would be our MOBA sample, Union: https://github.com/PlayFab/UNION-OpenSource-MOBA.

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.