question

Avinaya Banskota avatar image
Avinaya Banskota asked

How do I change the player ID to reflect the players name rather than randon numbers in the leaderboard?

Leaderboards and Statistics
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

You can retrieve players’ profile when calling API GetLeaderboard. As the documentation -- https://docs.microsoft.com/en-us/rest/api/playfab/client/player-data-management/getleaderboard?view=playfab-rest said, you can set the ProfileConstraints field to determine which properties need to be returned in the leaderboard entry. If you want to retrieve the Display Name, you can set the request body as this.

{
    "StatisticName": "Kill",
    "StartPosition": 0,
    "MaxResultsCount": 20,
    "ProfileConstraints": {
        "ShowDisplayName": true
    }
}

Please notice that client API GetLeaderboard can only request the allowed client profile properties. You can allow client access to these properties in the [Game Manage]->[Title Settings]->[Client Profile Option].

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.