question

Alex Vision avatar image
Alex Vision asked

Get player data from leaderboard players

Hello I have a problem. I need to show in leaderboard in game not only score, I need more values like player level. No problem with send data, but how get data for every players?

I get leaderboard like this: (Unity)

foreach (var item in result.Leaderboard){

...firstly made line with values

	lineLb[0].text = (item.Position + 1).ToString();

	lineLb[1].text = item.DisplayName

	lineLb[2].text = item.StatValue.ToString();

}

Something like item.Profile.TitleData[1].value.ToString(); would be very cool for me.

Player DataTitle Datadata
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

·
Gosen Gao avatar image
Gosen Gao answered

You could create another Leaderboard like “Level” to store player level. When you want to get Leaderboard of “Score”, you can add the parameter ProfileConstraints in the GetLeaderboard request body and set ShowStatistics to true, then it will return all the statistics of each player in Leaderboard “Score”.

But it is important to note that Statistics in Profile are not allowed to be read by the client by default. So before you call again, please navigate to [Game Manager]->[Title Setting]->[Client Profile Options]->[ALLOW CLIENT ACCESS TO PROFILE PROPERTIES]. And make sure the option “Statistics” is selected.

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.