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

Initializing Leaderboards

Before submitting scores or retrieving data, you will need to initialize a leaderboard. To do this, use the code below:

[SerializeField]
SteamLeaderboards steamLeaderboards;

IEnumerator AsyncInitializeLeaderboard() {
    steamLeaderboards.SetLeaderboard("My Awesome Leaderboard", 
        ELeaderboardSortMethod.k_ELeaderboardSortMethodDescending,
        ELeaderboardDisplayType.k_ELeaderboardDisplayTypeNumeric);
    
    while (steamLeaderboards.IsSearchingForLeaderboard)
    {
        yield return null;
    }
    
    Debug.Log("Leaderboard Initialized!");
    
    // Do what you want from here
}

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

Warning! If the leaderboard "My Awesome Leaderboard" does not exist, it will be created in Steamworks. This is especially useful when you don't want to manually create leaderboards in Steamworks website

Cool! Once we have the leaderboard in our hands, we can submit scores or retrieve data.

PreviousSetupNextSubmitting Scores

Last updated 2 years ago