question

Talha avatar image
Talha asked

GetFriendLeaderboard returns null

Hi, im creating a unity game.

Issue is that calling getfriendleaderboard return nothing. I have attached my code aswell.

As you can see the friends are all showing in the playfab dashboards.

In the leaderboard :

--

In the Friends Dashboard:

--

The client profile options are: AvatarUrl, DsiplayName, Locations= ON.

 void GetLeaderboard()
    {
      
        var request = new GetFriendLeaderboardRequest
        {
            IncludeFacebookFriends = true,
            MaxResultsCount = 75,
            StartPosition = 0,
            StatisticName = "Highscore",
            ProfileConstraints = new PlayerProfileViewConstraints()
            {
                ShowDisplayName = true,
                ShowAvatarUrl = true,
                ShowLocations = true
            }
        };


        PlayFabClientAPI.GetFriendLeaderboard(request, LeaderboardSuccess, LeaderboardFail);

    }


 void LeaderboardSuccess(GetLeaderboardResult result)
    {

        int count=0;
                foreach (var entry in result.Leaderboard) 
		{ 
		Debug.Log(entry.Profile.Locations[0].CountryCode.Value.ToString());
		Debug.Log(entry.DisplayName);
		Debug.Log(entry.StatValue);

		count++;
		}
}

Leaderboards and Statistics
untitled1.png (23.4 KiB)
untitled.png (33.1 KiB)
2 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.

Citrus Yan avatar image Citrus Yan commented ·

May I know your title id? And, what's the full response from GetFriendLeaderboard, can you share that?

0 Likes 0 ·
Talha avatar image Talha Citrus Yan commented ·

ID: 8A8A4..

I saved the result.Leaderboard in a json file which is completely empty "{}". This is beyond me, idk why is this happening.

0 Likes 0 ·
Citrus Yan avatar image
Citrus Yan answered

Player DCE4867911EECC72 has one friend in the friend list, however it's not in the Leaderboard for HighScore,

Could you please add the friends back just like the second pic you posted in question shows and try making the same request from Postman and see what the result is?


pic1.png (23.7 KiB)
10 |1200

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

Talha avatar image
Talha answered

Hi Im facing the same issue. its only with GetFriendLeaderboard.

could you please look into it? Title ID is the same.

Focal User is Friend2;

10 |1200

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

Talha avatar image
Talha answered

OH MY GOD.

Stupidest Mistake. I knew it would not be worth it. So much time spent and in the end the error was

StatisticName="Highscore",to StatisticName="HighScore",

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.