Documentation

Support

Get scores for other players

Retrieve scores for specific players in a leaderboard.
Read time 1 minuteLast updated 21 days ago

Get the scores for other players in the specified leaderboard with the
GetScoresByPlayerIdsAsync
method:
public async void GetScoresByPlayerIds(string leaderboardId){ var playerIds = new List<string>{ "abc123", "abc456" }; var scoresResponse = await LeaderboardsService.Instance .GetScoresByPlayerIdsAsync(leaderboardId, playerIds); Debug.Log(JsonConvert.SerializeObject(scoresResponse));}
To get the score with any associated metadata, use the
IncludeMetadata
option on the
GetScoresByPlayerIdsOptions
configuration object:
public async void GetScoresByPlayerIdsWithMetadata(string leaderboardId){ var playerIds = new List<string>{ "abc123", "abc456" }; var scoreResponse = await LeaderboardsService.Instance .GetScoresByPlayerIdsAsync( leaderboardId, playerIds, new GetScoresByPlayerIdsOptions { IncludeMetadata = true } ); Debug.Log(JsonConvert.SerializeObject(scoresResponse));}