question

Alen Jose avatar image
Alen Jose asked

Need help with GetFriendLeaderboardAroundPlayerRequest

So we have this code:

 public  void friendLeaderboard () {
        Debug.Log ("FRIEND");
        PlayFab.ClientModels.GetFriendLeaderboardAroundPlayerRequest request = new PlayFab.ClientModels.GetFriendLeaderboardAroundPlayerRequest ();
        request.StatisticName = "new_test_stars";
        request.IncludeFacebookFriends = true;
        request.ProfileConstraints.ShowLocations = true;
        PlayFabClientAPI.GetFriendLeaderboardAroundPlayer (request, friends_success , friend_error );
    }

and also:

   void friends_success (PlayFab.ClientModels.GetFriendLeaderboardAroundPlayerResult res) {
        Debug.Log ("FRIENDS");


        var x = res.Leaderboard;
        Debug.Log (x.Count);
        Debug.Log (x[0].DisplayName)


    }

but the size of res.Leaderboard is 1

and Debug.Log (x[0].DisplayName)

is my own name.

How do I get my friends names?

Everyone is logged in using :

   List<string> permissions = new List<string> ();


        permissions.Add ("user_friends");
        // We invoke basic login procedure and pass in the callback to process the result
        FB.LogInWithReadPermissions (permissions, OnFacebookLoggedIn);
Leaderboards and StatisticsFriends
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

Could you please tell us if these FB friends have registered PlayFab accounts or not? API reference of GetFriendLeaderboardAroundPlayer API mentions, “This API retrieves a list of ranked friends of the current player for the given statistic, centered on the requested PlayFab user. If PlayFabId is empty or null will return currently logged in user.

Besides, if these friends already have PlayfabIds, we would recommend youadd your Facebook friends to the PlayFab friend list via AddFriend API. It can prevent the failure to load friend list due to expired Facebook access tokens.

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.