question

brendan avatar image
brendan asked

Leaderboard "Try It"

Question from a developer:

 

I'm trying the Leaderboard API (https://api.playfab.com/Documentation/Client/method/GetLeaderboard) via the "Try It" option in the documentation, but it's returning no results (below) - why is that?

```

{
 "code": 200,
 "status": "OK",
 "data": {
  "Leaderboard": []
 },
 "CallBackTimeMS": 78
}
```
10 |1200

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

brendan avatar image
brendan answered

Looking at the title, there aren't any statistics reported for any of the players who have signed in. Once you have reported this statistic for players in your game, those player scores will populate your leaderboard.

10 |1200

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

ahmed.yalahwy@gmail.com avatar image
ahmed.yalahwy@gmail.com answered

Thanks , I got it

so now , I am using this method to update the user statistics

https://api.playfab.com/Documentation/Client/method/UpdateUserStatistics

but now , I can`t find C# code to implement a code like it? - there`s API explanation only & I can`t translate it to C# code

10 |1200

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

brendan avatar image
brendan answered
10 |1200

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

ahmed.yalahwy@gmail.com avatar image
ahmed.yalahwy@gmail.com answered

it does not update the user statistics , and give me error :

"No user data available" ,

"ErrorAPINotEnabledForGameClientAccess"

//the codes

public static void SetScore(int score)
{
UpdateUserStatisticsRequest request = new UpdateUserStatisticsRequest()
{
UserStatistics = new Dictionary<string, int>() {
{"score" , score}
}
};
PlayFabClientAPI.UpdateUserStatistics(request, (result) => {
Debug.Log("Success");
}
, (error) => {
Debug.Log("Error" + error.Error.ToString() + "\n");
Debug.Log(error.ErrorDetails.ToString());
Debug.Log(error.ErrorMessage);
Debug.Log(error.HttpCode);

/*I showed all these messages , just to detect the error well*/
});
}

10 |1200

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

brendan avatar image
brendan answered

By default, we do not trust the client for statistics posts or virtual currency balance changes - it's too easy for a hacked client to submit anything it wants to.

To use this from the Client API, you must change the "allow client" setting in the Settings->General tab for your game.

10 |1200

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

ahmed.yalahwy@gmail.com avatar image
ahmed.yalahwy@gmail.com answered

Hi

it works well

but now , when I export the game from unity it makes this error : Found plugins with same names and architectures , Plugins colliding with each other

be careful that I am using Facebook SDK and Playfab SDK in the same project.

10 |1200

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

brendan avatar image
brendan answered

There should be more to that message, specifying which plugins/dlls - can you provide the full text of the error message?

10 |1200

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

ahmed.yalahwy@gmail.com avatar image
ahmed.yalahwy@gmail.com answered

the full error

Found plugins with same names and architectures, Assets/Plugins/Android/libs/android-support-v4.jar (ARMv7) and Assets/Plugins/Android/android-support-v4.jar (ARMv7). Assign different architectures or delete the duplicate.
UnityEditor.AndroidPluginImporterExtension:CheckFileCollisions(String)
UnityEditorInternal.PluginsHelper:CheckFileCollisions(BuildTarget) (at C:/buildslave/unity/build/Editor/Mono/Plugins/PluginsHelper.cs:25)
UnityEditor.BuildPipeline:BuildPlayer(String[], String, BuildTarget, BuildOptions)
PlayFabPackager:MakeAndroidBuild() (at Assets/PlayFabSDK/Editor/PlayFabPackager.cs:32)

10 |1200

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

ahmed.yalahwy@gmail.com avatar image
ahmed.yalahwy@gmail.com answered

??

10 |1200

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

brendan avatar image
brendan answered

It sounds like the Facebook plugin also uses the same jar. Can you try deleting one and see if that resolves the issue?

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.