Leaderboards for Steam

Elevate your game with Steam Leaderboards! With just a few clicks in the Unity Editor, you can integrate your game with the Steamworks API, no extra configuration needed.

Welcome to the Steam Leaderboards documentation! We’re glad you decided to purchase this asset and we hope it helps you achieve your goals. If you have any questions, please don’t hesitate to reach out to us at help@leastsquares.io. And if you could, please consider rating the package or leaving a review on the asset page. This will help us grow and improve the asset.

Getting Started

Setup

The asset contains 2 main scripts which allow you to configure its usage. These are:

SteamEngine.cs:

This script is responsible for loading the Steam runtime and should be attached to an empty GameObject in the scene.

SteamEngine.cs Script Reference

Property Type Description Default Value
AppId uint The Steam application id to use. The default is 480 which is Steam’s test id. For more information please review Steamworks Applications 480

SteamLeaderboard.cs:

This script should be attached to an empty GameObject and holds the desired configuration for the leaderboard.

SteamLeaderboard.cs Script Reference

Property Type Description Default Value
Name string Name for the leaderboard inside the Steamworks API. Set this to be a name that makes sense as part of internal development. null
Sort Method SteamLeaderboardSort Set the order for the leaderboard sorting. For positional based leaderboards, use Ascending. For high-score, use Descending Descending
Display Type SteamLeaderboardDisplay Determines the types of data to be displayed with the leaderboard. Select from Numeric, Seconds or Milliseconds. Numeric

Demo

The asset includes a demo scene that loads a leaderboard from the default Steam appid (480, space war). It provides a small example of how to use the API to load leaderboard entries into the Unity UI, displaying names, scores, ranks, and avatars.

LeaderboardUI.cs

Script to fill the leaderboard UI from the Steam leaderboard. It retrieves the results from SteamLeaderboard.cs (if available) and created rows for them inside a scrollable view.

LeaderboardUIRow.cs

Class that represents a UI row for a leaderboard entry. It just holds references to it’s children UI elements, for easy access.

Troubleshooting

Is Steam running?

If the leaderboard is not loading, it could be because Steam is not running on the computer and the game cannot connect to Steam services.

Is the AppId correct?

If the leaderboard is not loading, it could be because of an incorrect or disabled appid. The demo scene uses Steam’s default appid for testing (480), also known as the space war demo game app id. During development, you can use the test app id, but to release your game, you will need your own application. Please see Steamworks Applications for more information on creating an application and getting your appid.

Restart Unity Editor

Steam works by injecting code into the process that calls it. While it should work fine most of the time, Unity does not recreate the process when restarting a scene, which could result in Steam loading incorrectly. Restarting the Unity Editor can sometimes resolve these issues.



About us

We are a small company focused on building tools for game developers. Send us an email to careers@leastsquares.io if interested in working with us. For any other inquiries, feel free to contact us at hello@leastsquares.io or contact us on the discord





Sign up to our newsletter.

Want to receive news about discounts, new products and updates?