Documentation

​
​

Development

User Acquisition

Monetization

Industry

Leaderboards

Unity SDK

Admin API

Client API

Open Unity Dashboard

Leaderboards

LiveOps
​
​
Leaderboards
  • Overview
  • Get started
  • Concepts
  • Tutorials
    • Configuration
    • Unity SDK tutorial
      • Add a new score
      • Get the player's score
      • Get scores
      • Get a range of scores centered around the player
      • Get scores for other players
      • Get scores for a certain tier
      • Get a list of available leaderboard versions
      • Get the player's score from a leaderboard version
      • Get scores from a leaderboard version
      • Get a range of scores centered around the player from a leaderboard version
      • Get scores for other players from a leaderboard version
      • Get scores for a certain tier from a leaderboard version
    • Unity SDK sample
    • Cloud Code samples
  • Reference
  • Privacy and consent
  1. Leaderboards
  2. Unity SDK tutorial

Get a range of scores centered around a player from a leaderboard version

Retrieve a range of scores centered around a player from an archived leaderboard.
Read time 1 minute
Last updated 9 months ago

To get a range of scores centered around a player from an archived leaderboard, use the
GetVersionPlayerRangeAsync
method:
public async void GetVersionPlayerRange(string leaderboardId, string versionId){ // Returns a total of 11 entries (the given player plus 5 on either side) var rangeLimit = 5; var scoresResponse = await LeaderboardsService.Instance.GetVersionPlayerRangeAsync( leaderboardId, versionId, new GetVersionPlayerRangeOptions{ RangeLimit = rangeLimit } ); Debug.Log(JsonConvert.SerializeObject(scoresResponse));}
Note
Metadata is not retrieved by default.
To get the score with any associated metadata, use the
IncludeMetadata
option on the
GetVersionPlayerRangeOptions
configuration object:
public async void GetVersionPlayerRangeWithMetadata(string leaderboardId, string versionId){ var scoresResponse = await LeaderboardsService.Instance .GetVersionPlayerRangeAsync( leaderboardId, versionId, new GetVersionPlayerRangeOptions { IncludeMetadata = true } ); Debug.Log(JsonConvert.SerializeObject(scoresResponse));}
For details on how to get available leaderboard version IDs, visit Get available leaderboard version.
Note
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
.

Copyright © 2026 Unity Technologies
LegalPrivacy PolicyCookiesDocumentation Terms of UseDo Not Sell or Share My Personal InformationYour Privacy Choices (Cookie Settings)

"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S and elsewhere (more info here). Other names or brands are trademarks of their respective owners.

Some pages are machine-translated for convenience, and may contain inaccuracies. In the event of conflicting information, the English version is authoritative.


    Report a problem with this page