question

Hiruna Pallage avatar image
Hiruna Pallage asked

Is it possible to add custom information to a leaderboard on PlayFab?

Hello PlayFab Team,

I hope this message finds you well. I have been exploring the capabilities of PlayFab and am impressed with its leaderboard features. However, I have a specific requirement that I'd like to address.

  1. Firstly, is it possible to include custom information or data fields within a leaderboard on PlayFab? For instance, I would like to associate additional information with each leaderboard entry, such as a player's avatar, a custom label, or some other player-specific metadata. This customization would not only enhance the leaderboard's visual appeal but also provide more context about each player's achievements. If this feature is available, could you please guide me on how to implement it or provide some documentation to refer to?

  2. If the above feature is currently not available, is there any possible way to track at least one custom field within the leaderboard? My specific requirement is to replace the "Name" column data with custom unique names that players add when they sign up for the game. Currently, PlayFab automatically derives the name from the email address before the "@" symbol and uses it as the "Name" in the leaderboard. I would like to allow players to have more control over this field to personalize their display names.

I appreciate any assistance you can offer in achieving these customizations or providing insights into possible workarounds.

Thank you for your time and support.

Best regards, Hiruna

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

·
Infer Wang avatar image
Infer Wang answered

You can use the ProfileConstraints parameter in the GetLeaderboard API methods to specify which fields you want to retrieve from the player profile. For example, if you want to request the DisplayName and AvatarUrl fields to show the player’s custom name and avatar in the leaderboard. First, use API UpdateAvatarUrl and UpdateUserTitleDisplayName to set the value, as a result, they are saved in the title player(GameManager->Players->Overview). 6332-image.png Second, refer to this, allow client to access. Third, call API to get it, following may be a possible request example.

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

You can also use the CustomTags field to store any other metadata that you want to associate with each player.


image.png (31.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.

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.