Submitting Scores

To submit leaderboard scores you first need to initialize it (as explained on the previous page). Once the leaderboard is initialized, use the code below to submit a score:

[SerializeField]
SteamLeaderboards steamLeaderboards;

IEnumerator AsyncPostScoreToLeaderboard()
{
    steamLeaderboards.UpdateScoreToCurrentLeaderboard(1000);

    while (steamLeaderboards.IsPostingLeaderboardScore)
    {
        yield return null;
    }

    Debug.Log("Score submitted!");
    
    // Do what you want from here
}

The method AsyncPostScoreToLeaderboard() is a Coroutine because calls to the Leaderboard API are asynchronous

Last updated