文档

​
​

Development

User Acquisition

Monetization

工业

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 scores from a leaderboard version

Retrieve a list of scores from a specific leaderboard.
阅读时间1 分钟
最后更新于 9 个月前

Players can get scores from a specified leaderboard version with the
GetVersionScoresAsync
method. By default the method fetches the top 10 scores:
public async void GetVersionScores(string leaderboardId, string versionId){ var scoresResponse = await LeaderboardsService.Instance .GetVersionScoresAsync(leaderboardId, versionId); Debug.Log(JsonConvert.SerializeObject(scoresResponse));}
Paginated access to all scores in the leaderboard is available by specifying the optional
GetVersionScoresOptions
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 GetPaginatedVersionScores(string leaderboardId, string versionId){ var scoresResponse = await LeaderboardsService.Instance.GetVersionScoresAsync( leaderboardId, versionId, new GetVersionScoresOptions{ 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 in the
GetVersionScoresOptions
configuration object:
public async void GetVersionScoresWithMetadata(string leaderboardId, string versionId){ var scoresResponse = await LeaderboardsService.Instance.GetVersionScoresAsync( leaderboardId, versionId, new GetVersionScoresOptions { IncludeMetadata = true } ); Debug.Log(JsonConvert.SerializeObject(scoresResponse));}
For details on how to get available leaderboard version IDs, see 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
.

Copyright © 2026 Unity Technologies
法律信息隐私政策CookiesDocumentation Terms of Use请勿出售或分享我的个人信息您的隐私选择(Cookie 设置)

“Unity”、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属公司在美国和其他地方的商标或注册商标(此处查看更多信息)。其他名称或品牌是其各自所有者的商标。

为方便起见,一些页面是机器翻译的,可能包含不准确的内容。如有信息不一致的情况,以英文版本为准。


    报告此页面的问题