A lightweight, modular integration layer for Steamworks.NET that exposes Steam features through flexable components and a type-safe generated code wrapper.
Support Heathen by becoming a GitHub Sponsor. Sponsorship directly funds the development and maintenance of free tools like this, as well as our game development Knowledge Base and community on Discord.
Sponsors also get access to our private SourceRepo, which includes developer tools for O3DE, Unreal, Unity, and Godot.
Learn more or explore other ways to support @ heathen.group/kb
Foundation maps Steamworks interfaces to Unity-friendly patterns, primarily focused on User Data, Stats, Achievements, and Leaderboards. It operates via two main systems:
| System | Purpose |
|---|---|
| Generated Wrapper | A static SteamTools.Game class that provides type-safe access to your specific App IDs and API names. |
| Modular Components | MonoBehaviours that allow you to build Steam-driven UI in the Inspector without writing glue code. |
The following core features are covered:
- Core β Application IDs, multi-app support (Main, Demo, Playtest), and automated initialization.
- User β Persona names, Steam levels, online status, and avatars.
- Stats β Integer and Float stat management with local caching and server sync.
- Achievements β Localized names, descriptions, icons, and unlock/lock state.
- Leaderboards β Score uploading, rank retrieval, and entry display.
- Unity engine 6.0 or compatible
- A registered Steamworks developer account
- Steamworks.NET
- In Unity, go to
Window > Package Manager. - Click + > Add package from git URL.
- Enter:
https://github.com/heathen-engineering/Unity-Foundation-for-Steamworks.git?path=/com.heathen.steamworksfoundation
Steamworks.NET is installed automatically. On the first domain reload after Foundation is imported, the editor will detect if Steamworks.NET is missing and prompt you to install the recommended version. If you need a specific version, menu items are available under Help > Heathen > Steamworks Foundation > Install Steamworks.NET β¦.
Open Project Settings > Steamworks. Define your App IDs and list your API names (Achievements, Stats, Leaderboards) exactly as they appear in the Steamworks Partner Portal.
Click Generate Code in the settings panel. This creates Assets/Scripts/Generated/SteamTools.Game.cs. This wrapper provides static access to your data:
// Type-safe access to your Steam data
uint id = SteamTools.Game.AppId;
SteamTools.Game.Achievements.ACH_WIN_ONE_GAME.Unlock();
int wins = SteamTools.Game.Stats.NumWins.GetInt();No code required: Add the InitializeSteamworks component to a GameObject in your startup scene. It calls SteamTools.Game.Initialise() automatically and respects the OnReady event without any scripting.
From code: Call the init method once at startup and subscribe to OnReady to know when leaderboard handles and user data are fully populated.
void Awake() {
SteamTools.Game.Initialise();
SteamTools.Interface.OnReady += () => Debug.Log("Steam is Ready");
}Foundation uses a Parent-Child modular design. The parent component holds the data reference, and child components on the same GameObject automatically react to it.
| Parent | Child Component | Purpose |
|---|---|---|
| SteamUserData | SteamUserName |
Displays persona name in a TMP label. |
SteamUserStatus |
Displays online/offline status. | |
| SteamAchievementData | SteamAchievementIcon |
Displays achievement icon in a UI Image. |
SteamAchievementChanged |
Fires a UnityEvent on unlock. |
| Parent | Child Component | Purpose |
|---|---|---|
| SteamLeaderboardData | SteamLeaderboardRank |
Displays the local user's rank. |
SteamLeaderboardDisplay |
Populates a list/grid of leaderboard entries. |
C# Example β Committing Stat Changes:
using Heathen.SteamworksIntegration;
// Update local cache
SteamTools.Game.Stats.NumWins.SetInt(newWins);
// Sync with Steam Servers
API.StatsAndAchievements.Client.StoreStats();C# Example β Uploading Leaderboard Scores:
var board = SteamTools.Game.Leaderboards.TopScores;
board.UploadScore(score, ELeaderboardUploadScoreMethod.k_ELeaderboardUploadScoreMethodKeepBest,
(result, error) => { /* handle result */ });| Namespace | Contents |
|---|---|
Heathen.SteamworksIntegration |
Core data types (UserData, AchievementData) and components. |
Heathen.SteamworksIntegration.API |
Low-level static wrappers for Steam interfaces. |
SteamTools |
The generated wrapper (Game, Interface, Events). |