ドキュメント

サポート

Get scores

Retrieve a list of scores from a leaderboard.
読み終わるまでの所要時間 1 分最終更新 3ヶ月前

Players can get the scores from a specified leaderboard with the
GetScoresAsync
method. You should create your leaderboard first and then substitute the
leaderboardId
for your own ID. By default the method will fetch the top 10 scores:
public async void GetScores(string leaderboardId){ var scoresResponse = await LeaderboardsService.Instance .GetScoresAsync(leaderboardId); Debug.Log(JsonConvert.SerializeObject(scoresResponse));}
Paginated access to all scores is available by specifying the optional
GetScoresOptions
object with the optional
Offset
and
Limit
pagination arguments.
Offset
is the number of entries to skip when retrieving the leaderboard scores and defaults to 0.
Limit
is the number of leaderboard scores to return and defaults to 10.
public async void GetPaginatedScores(string leaderboardId){ var scoresResponse = await LeaderboardsService.Instance.GetScoresAsync( leaderboardId, new GetScoresOptions{ Offset = 25, Limit = 50 } ); Debug.Log(JsonConvert.SerializeObject(scoresResponse));}
Metadata is not retrieved by default.
To get the score with any associated metadata, use the
IncludeMetadata
option on the
GetScoresOptions
configuration object:
public async void GetScoresWithMetadata(string leaderboardId){ var scoreResponse = await LeaderboardsService.Instance .GetScoresAsync( leaderboardId, new GetScoresOptions { IncludeMetadata = true } ); Debug.Log(JsonConvert.SerializeObject(scoreResponse));}
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
.