Lucky Raccoon Games
  • Start Here
  • Really Simple Steam Integration
    • Setup
    • Running Demo Scenes
    • Leaderboards
      • Setup
      • Initializing Leaderboards
      • Submitting Scores
      • Retrieving Leaderboard Data
    • Stats and Achievements
      • Setup
      • Unlocking Achievements Directly
      • Unlocking Achievements from Stats
    • Cloud Save
      • Setup
      • Saving and Loading Data
    • Friends List
      • Setup
      • Getting Friends Data
    • Drag & Drop UI Components
    • Troubleshooting
    • Useful Links
  • Really Simple Tutorials
    • Setup
    • Running Demo Scenes
    • Tutorial Screen
      • Categories
      • Items
      • Setting up the screen with your data
      • Tutorial Manager anatomy
    • Tutorial Popup
      • Showing and hiding Popups
      • Tutorial Popup anatomy
    • Integrations
      • New Input System
    • Troubleshooting
  • Support
Powered by GitBook
On this page
  1. Really Simple Steam Integration
  2. Leaderboards

Retrieving Leaderboard Data

You can still retrieve the data of a certain leaderboard and show it to the player. There are 3 ways to achieve this:

Global Top Scores

Retrieve a list of scores based on the best global scores:

[SerializeField]
SteamLeaderboards steamLeaderboards;

IEnumerator AsyncGetLeaderboardEntries()
{
    steamLeaderboards.GetCurrentLeaderboardGlobal(1, 10); // 1st to 10th plyers

    while(steamLeaderboards.IsGettingLeaderboardEntries)
    {
        yield return null; // Wait until leaderdords data are fetched
    }

    // Wait a while for the avatar images to load or ignore this line
    // if you only want to get the player names
    yield return new WaitForSeconds(1.5f);

    foreach (SteamLeaderboardEntry leaderboardEntry in steamLeaderboards.LeaderboardEntries)
    {
        // Do whatever you want
    }
}

Scores Around Player

Retrieve a list of scores around player:

[SerializeField]
SteamLeaderboards steamLeaderboards;

IEnumerator AsyncGetLeaderboardEntries()
{
    steamLeaderboards.GetCurrentLeaderboardGlobalAroundUser(-5, 5); // 5 before and 5 after player

    while(steamLeaderboards.IsGettingLeaderboardEntries)
    {
        yield return null; // Wait until leaderdords data are fetched
    }

    // Wait a while for the avatar images to load or ignore this line
    // if you only want to get the player names
    yield return new WaitForSeconds(1.5f);

    foreach (SteamLeaderboardEntry leaderboardEntry in steamLeaderboards.LeaderboardEntries)
    {
        // Do whatever you want
    }
}

Player And Friends

Retrieve the list of scores of the player and his friends

[SerializeField]
SteamLeaderboards steamLeaderboards;

IEnumerator AsyncGetLeaderboardEntries()
{
    steamLeaderboards.GetCurrentLeaderboardFriends();

    while(steamLeaderboards.IsGettingLeaderboardEntries)
    {
        yield return null; // Wait until leaderdords data are fetched
    }

    // Wait a while for the avatar images to load or ignore this line
    // if you only want to get the player names
    yield return new WaitForSeconds(1.5f);

    foreach (SteamLeaderboardEntry leaderboardEntry in steamLeaderboards.LeaderboardEntries)
    {
        // Do whatever you want
    }
}

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

PreviousSubmitting ScoresNextStats and Achievements

Last updated 2 years ago