Understanding Steam Stats and the Heathen Engineering tool kit

Like what your seeing?

Consider supporting us as a GitHub Sponsor and get instant access to all our Unity assets, exclusive tools and assets, escalated support and issue tracking and our gratitude. These articles are made possible by our GitHub Sponsors ... become a sponsor today!


Please note that you must call StoreStatsAndAchievements to apply changes to the Steam backend, and thus cause the notification to pop up.
Stats and Achievements (Steamworks Documentation)

Creating Stats

Stats work much like achievements however they cannot be imported from Valve directly so you must add your stats to your system manually.
Once you add a sate you need to provide its API name exactly as you created it in the Steam Developer Portal.

Using Stats

See the Int Stat Object, Float Stat Object and Avg Rate Stat Object for details on how to use each. In general though the process is that you will create a reference to the stat in question in one of your game's scripts such as
public IntStatObject myIntStat;
This will make a new reference slot you can drag and drop your stat into on the Unity inspector for that object.
You can now drag the desired stat object from your Steam Setting into that slot.
Your script can now perform actions in relation to that stat
// Read the stat value
Debug.Log("Value is " + myIntStat.Value);
// Set the stat value
myIntStat.Value = 42;
// Store the stat values (effects all stats)