Achievements & Stats for Steam
Welcome to the Steam Achievements 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
Configuring Steam Achievements
Steam achievements are only configured through the Steam Dashboard. Please read the overview. After that go to your apps achievement page and start setting up the achievements.
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 |
SteamAchievementAndStats.cs
:
This script should be attached to an empty GameObject. At start it will retrieve the stats and achievements from the Steam servers and display them on the editor. It can be referenced and called in order to get achievements, get stats, trigger a specific achievement, or update and set stats.
SteamAchievementAndStats.cs
Script Reference
Property | Type | Description | Default Value |
---|---|---|---|
Achivement Identifiers |
string[] |
The achievements loaded from the Steam servers. | [] |
Demo
The asset includes a demo scene that loads all the achievements from the default Steam appid (480, spacewar). It provides a small example of how to use the API to load achievements into the Unity UI, displaying names, icons and a button to trigger them.
AchievementUI.cs
Script to fill the achivements UI from the achievement list. It retrieves the results from SteamAchievementAndStats.cs
(if available) and creates rows for them inside a scrollable view.
AchievementUIRow.cs
Class that represents a UI row for an achievement 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?