Get a range of scores centered around the player
Retrieve scores for a player and their neighboring competitors.
Read time 1 minuteLast updated 21 days ago
To get the entries of the player as well as the specified number of neighboring players ranked on either side of the player, use the
GetPlayerRangeAsyncpublic async void GetPlayerRange(string leaderboardId){ // Returns a total of 11 entries (the given player plus 5 on either side) var rangeLimit = 5; var scoresResponse = await LeaderboardsService.Instance.GetPlayerRangeAsync( leaderboardId, new GetPlayerRangeOptions{ RangeLimit = rangeLimit } ); Debug.Log(JsonConvert.SerializeObject(scoresResponse));}
To get the score with any associated metadata, use the
IncludeMetadataGetPlayerRangeOptionspublic async void GetPlayerRangeWithMetadata(string leaderboardId){ var scoresResponse = await LeaderboardsService.Instance .GetPlayerRangeAsync( leaderboardId, new GetPlayerRangeOptions() { IncludeMetadata = true } ); Debug.Log(JsonConvert.SerializeObject(scoresResponse));}