Documentation

​
​

Development

User Acquisition

Monetization

Industry

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

Add a new score

Add or update a score for a player in a leaderboard.
Read time 1 minute
Last updated 7 days ago

To add or update an entry for the player in the specified leaderboard, use the
AddPlayerScoreAsync
method.
public async void AddScore(string leaderboardId, int score) { var playerEntry = await LeaderboardsService.Instance .AddPlayerScoreAsync(leaderboardId, score); Debug.Log(JsonConvert.SerializeObject(playerEntry)); }

Add a new score with metadata

To add a score with metadata, use the
Metadata
option on the
AddPlayerScoreOptions
configuration object:
[Serializable] public class ScoreMetadata { public string levelName; public int timeTaken; } public async void AddScoreWithMetadata(string leaderboardId, int score) { var scoreMetadata = new ScoreMetadata { levelName = "LEVEL_01", timeTaken = 120 }; var playerEntry = await LeaderboardsService.Instance .AddPlayerScoreAsync( leaderboardId, score, new AddPlayerScoreOptions { Metadata = scoreMetadata } ); Debug.Log(JsonConvert.SerializeObject(playerEntry)); }
If a score that has stored metadata is updated with null metadata, the new metadata value will be null.
Leaderboard score metadata can be up to 1024 bytes (1 KB).

Copyright © 2026 Unity Technologies
LegalPrivacy PolicyCookiesDocumentation Terms of UseDo Not Sell or Share My Personal InformationYour Privacy Choices (Cookie Settings)

"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S and elsewhere (more info here). Other names or brands are trademarks of their respective owners.

Some pages are machine-translated for convenience, and may contain inaccuracies. In the event of conflicting information, the English version is authoritative.

  • On this page
    • Add a new score with metadata


Report a problem with this page