question

spartan666nm avatar image
spartan666nm asked

Is there a way to create Leaderboards and add some players to them via code

I have 2 Questions:

1- is there a way to create playfab leaderboards via code?

2-is there a way to add some players to leaderboards and some not? (like a regional leaderboard so a player from France is in the global leaderboard and the France regional leaderboard)

unity3dCloudScriptLeaderboards 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

>> is there a way to create playfab leaderboards via code?

When you use the PlayFab Server API UpdatePlayerStatistics to add a new statistic for any one player of your title, a corresponding new leaderboard will be generated. You can use the leaderboard management API to manage this leaderboard later. Besides, please note the maximum number of the player statistics (leaderboards) that can be defined under a title can’t exceed 300. You can navigate to your title’s [Game Manager]->[Title Settings]->[Limits] or navigate to the https://developer.playfab.com/en-US/[YourTitleId]/limits (please replace [YourTitleId] with your actual title Id) to check the limits of your title.

>> is there a way to add some players to leaderboards and some not? (like a regional leaderboard so a player from France is in the global leaderboard and the France regional leaderboard)

In PlayFab, only the players who own some statistic will be in the corresponding leaderboard, and if the players have no corresponding statistics, they won’t be in the corresponding leaderboards. It means you can place players to different leaderboards through giving different statistics to them.

You can write you own server-side logic to determine which region the player is from, if the player is from French, you can add the statistic “FranceLeaderboard” to them without adding other region’s statistics. Now we suggest you host the server-side logic on the CloudScript using Azure Functions, so that players can call the API ExecuteFunction to pass some parameters to the function and execute it to do the verification and update the 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.

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.