Get available leaderboard versions

If the leaderboard resets and existing scores are archived, this call returns the current leaderboard versionId, and a list of archived versions in reverse chronological order. For example, the first entry is the archived version containing the most recent scores. If you have a scheduled reset configured on your leaderboard, this method also returns the next time that the leaderboard resets based on your schedule as the nextReset property.

Use the GetVersionsAsync method below to get a list of available leaderboard versions:

C#

public async void GetLeaderboardVersions()
{
    var versionsResponse = await LeaderboardsService.Instance
        .GetLeaderboardVersions(leaderboardId);

    // Get the ID of the most recently archived Leaderboard version
    var versionId = versionsResponse.Results[0].Id;

    Debug.Log(JsonConvert.SerializeObject(versionsResponse.Result));
}

Retrieving a set of the most recent versions only is available with the GetVersionsOptions object with the optional Limit pagination argument. Limit is the number of leaderboard scores to return, starting with the most recent. Defaults to null and returns all versions.

C#

public async void GetLeaderboardVersions()
{
    var versionsResponse = await LeaderboardsService.Instance
        .GetVersionsAsync(
            leaderboardId,
            new GetVersionsOptions { Limit = 10 );

    // Get the ID of the most recently archived Leaderboard version
    var versionId = versionsResponse.Results[0].Id;

    Debug.Log(JsonConvert.SerializeObject(versionsResponse.Result));
}