Every leaderboard maintains a versionId to identify its current live version. It also maintains an array of versions for previous archived resets.
- Each leaderboard can have 10,000 archived versions.
- On exceeding the archive limit the oldest leaderboard archives are deleted on a first-in, first-out (FIFO) basis.
If you want to be able to look at previous versions of the leaderboards then you you will need to get the leaderboard version you want to see.
You can use us the GetVersionsAsync
method below to get a list of available leaderboard versions:
public async void GetLeaderboardVersions(string leaderboardId){ var versionsResponse = await LeaderboardsService.Instance .GetVersionsAsync(leaderboardId); // Get the ID of the most recently archived Leaderboard version var versionId = versionsResponse.Results[0].Id; Debug.Log(JsonConvert.SerializeObject(versionsResponse.Results));}
Once you have this players can get their entry in the specified leaderboard archive version with the GetVersionPlayerScoreAsync
method:
public async void GetPlayerVersionScore(string leaderboardId, string versionId){ var scoreResponse = await LeaderboardsService.Instance .GetVersionPlayerScoreAsync(leaderboardId, versionId); Debug.Log(JsonConvert.SerializeObject(scoreResponse));}
To get the score with any associated metadata, use the IncludeMetadata
option on the GetVersionPlayerScoreOptions
configuration object:
public async void GetPlayerVersionScoreWithMetadata(string leaderboardId, string versionId){ var scoreResponse = await LeaderboardsService.Instance .GetVersionPlayerScoreAsync( leaderboardId, versionId, new GetVersionPlayerScoreOptions { IncludeMetadata = true } ); Debug.Log(JsonConvert.SerializeObject(scoreResponse));}
You can find more information on archived leaderboards here.