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

To get a range of scores centered around a player from an archived leaderboard, use the GetVersionPlayerRangeAsync method:

C#

public async void GetVersionPlayerRange()
{
    var versionId = “”;
    // Returns a total of 11 entries (the given player plus 5 on either side)
    var rangeLimit = 5;
    var response = await LeaderboardsService.Instance.GetVersionPlayerRangeAsync(
        leaderboardId,
        versionId,
        new GetVersionPlayerRangeOptions{ RangeLimit = rangeLimit }
    );
    Debug.Log(JsonConvert.SerializeObject(response));
}

To get the score with any associated metadata, use the IncludeMetadata option in the GetVersionPlayerRangeOptions configuration object:

C#

public async void GetVersionPlayerRangeWithMetadata()
{
    var options = ;
    var scoreResponse = await LeaderboardsService.Instance
        .GetVersionPlayerRangeAsync(
            leaderboardId,
            versionId,
            new GetVersionPlayerRangeOptions { 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.