Get scores for other players from a leaderboard version
Get the scores for other players from a leaderboard version with the GetVersionScoresByPlayerIdsAsync
method:
C#
public async void GetVersionScoresByPlayerIds()
{
var otherPlayerIds = new List<string>{ "abc123", "abc456" };
var scoresResponse = await LeaderboardsService.Instance
.GetVersionScoresByPlayerIdsAsync(leaderboardId, versionId, otherPlayerIds);
Debug.Log(JsonConvert.SerializeObject(scoresResponse));
}
To get the score with any associated metadata, use the IncludeMetadata
option in the GetVersionScoresByPlayerIdsOptions
configuration object:
C#
public async void GetVersionScoresByPlayerIdsWithMetadata()
{
var scoreResponse = await LeaderboardsService.Instance
.GetVersionScoresByPlayerIdsAsync(
leaderboardId,
new GetVersionScoresByPlayerIdsOptions { IncludeMetadata = true });
Debug.Log(JsonConvert.SerializeObject(scoreResponse));
}
Metadata is not retrieved by default.
For details on how to get available leaderboard version IDs, visit Get available leaderboard version.
For methods that retrieve scores: if your player has not submitted a score and the leaderboard is bucketed, the player is not assigned a bucket. A failed score retrieval returns an error that has its Reason
field set to ScoreSubmissionRequired
.