question

olafrogowski avatar image
olafrogowski asked

GetLeaderboard and GetFriendLeaderboard sometimes return empty list

Hello,

I have an issue with leaderboards, namely when i try to get leaderboard entries the requests sometimes return an empty list.
These are my requests:

protected const string STATISTIC_NAME = "RankingPoints";
    protected const int MAX_TOP_ENTRIES_COUNT = 3; //default 10, max 100
    protected const int MAX_FRIENDS_ENTRIES_COUNT = 50; //default 10, max 100
    protected const int MAX_CLOSE_ENTRIES_COUNT = 9; //default 10, max 100
    protected const int MAX_USER_ENTRIES_COUNT = 1; //default 10, max 100


    protected PlayerProfileViewConstraints PROFILE_CONSTRAINS =
        new PlayerProfileViewConstraints
        {
            ShowStatistics = true,
            ShowLinkedAccounts = true,
            ShowLocations = true,
            ShowDisplayName = true
        };


private void GetFriendsLeaderBoard(int version = -1) { var request = new GetFriendLeaderboardRequest { StatisticName = STATISTIC_NAME, MaxResultsCount = MAX_FRIENDS_ENTRIES_COUNT, ProfileConstraints = PROFILE_CONSTRAINS }; PlayFabClientAPI.GetFriendLeaderboard(request, GetFriendsLeaderboardsCallback,ErrorCallback); }
private void GetFriendsLeaderboardsCallback(GetLeaderboardResult result) { GetLeaderboardCallback(result.Leaderboard, FriendsLeaderboardEntries, LeaderboardRequestType.FriendsFull); Debug.LogError($"Friends Leaderboards All entry count: {result.Leaderboard.Count}"); }

private void GetGlobalLeaderBoard(int version = -1) { var request = new GetLeaderboardRequest { StatisticName = STATISTIC_NAME, MaxResultsCount = MAX_TOP_ENTRIES_COUNT, ProfileConstraints = PROFILE_CONSTRAINS }; PlayFabClientAPI.GetLeaderboard(request, GetGlobalLeaderboardsCallback, ErrorCallback); }

private void GetGlobalLeaderboardsCallback(GetLeaderboardResult result) { GetLeaderboardCallback(result.Leaderboard, GlobalLeaderboardEntries, LeaderboardRequestType.GlobalFull); Debug.LogError($"Global Leaderboards TOP entry count: {result.Leaderboard.Count}"); }
Leaderboards and Statistics
4 comments
10 |1200

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

Seth Du avatar image Seth Du ♦ commented ·

Can you reproduce this issue via Postman (RESTful testing tool)? What is the complete callback result?

0 Likes 0 ·
olafrogowski avatar image olafrogowski commented ·

@SethDu When i've been sending those specific requests via Postman over and over again and everything seems to be fine.
As for callback result it contains the following fields:

"code" - which is always 200
"status" - which is always OK
"Leaderboard" - an array of objects containing "PlayFabId", "StatValue", "Position" and "Profile" fields
"Version" - in my case always 0

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ olafrogowski commented ·

Are you indicating that if using Postman, the callback result is always successful, meanwhile the empty result only occurs on C#/Unity?

0 Likes 0 ·
olafrogowski avatar image olafrogowski Seth Du ♦ commented ·

Yes, that seems to be the case

0 Likes 0 ·

1 Answer

·
Seth Du avatar image
Seth Du answered

I have tried to reproduce this issue for few times but won't succeed. If Postman always returns the correct callback, there should be errors in your C# codes. You may check the request and stringify the whole returned result for troubleshooting.

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.