Get scores for a certain tier from a leaderboard version
Retrieve scores filtered by tier from a specified leaderboard version.
Read time 1 minuteLast updated 8 months ago
To get scores for a particular tier from a leaderboard version, use the method. By default this method returns the top 10 scores from the specified tier:
GetVersionScoresByTierAsyncpublic async void GetVersionScoresByTier(string leaderboardId, string versionId){ var scoresResponse = await LeaderboardsService.Instance .GetVersionScoresByTierAsync(leaderboardId, versionId, "silver"); Debug.Log(JsonConvert.SerializeObject(scoresResponse));}
Paginated access to all scores within the tier is available by specifying the optional object with the optional and pagination arguments.
GetVersionScoresByTierOptionsOffsetLimitOffsetLimitpublic async void GetPaginatedVersionScoresByTier(string leaderboardId, string versionId){ var scoresResponse = await LeaderboardsService.Instance.GetVersionScoresByTierAsync( leaderboardId, versionId, "silver", new GetVersionScoresByTierOptions{ Offset = 25, Limit = 50 } ); Debug.Log(JsonConvert.SerializeObject(scoresResponse));}
To get the score with any associated metadata, use the option on the configuration object:
IncludeMetadataGetVersionScoresByTierOptionspublic async void GetVersionScoresByTierWithMetadata(string leaderboardId, string versionId){ var scoresResponse = await LeaderboardsService.Instance.GetVersionScoresByTierAsync( leaderboardId, versionId, "silver", new GetVersionScoresByTierOptions { IncludeMetadata = true } ); Debug.Log(JsonConvert.SerializeObject(scoresResponse));}
For details on how to get available leaderboard version IDs, visit Get available leaderboard version.