Foundation for Steamworks

August 8, 2026 ยท View on GitHub

Important

๐Ÿ”€ This repo has moved to Codeberg

The active copy now lives at codeberg.org/Heathen-Engineering/Unity-Foundation-for-Steamworks โ€” please point your git remote, UPM manifest, or Gem reference there going forward. That's where new commits, releases, and issues actually happen now.

This GitHub copy is preserved as-is and still works for anyone already pointing at it, but it isn't receiving new updates. It will be archived (read-only) once every downstream package that depends on it has finished migrating too, not immediately.

Questions? Discord.

Foundation for Steamworks

License Maintained Unity Dependency

A lightweight, modular integration layer for Steamworks.NET that exposes Steam features through flexable components and a type-safe generated code wrapper.


๐Ÿ›  Also Available For

Godot O3DE


Become a GitHub Sponsor

Prefer a one-time purchase? Heathen's own storefront is live, direct source access at heathen.group/pricing, no sponsorship required.

Discord GitHub followers
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


What it does

Foundation maps Steamworks interfaces to Unity-friendly patterns. It fully owns User, Stats, Achievements, and Leaderboards with a complete, ready-to-use API and Inspector components for each, plus a wider layer of DLC, App/ownership, and Steam Input/Lobby data plumbing that the Toolkit tier builds ergonomics on top of. It operates via two main systems:

SystemPurpose
Generated WrapperA static SteamTools.Game class that provides type-safe access to your specific App IDs and API names.
Modular ComponentsMonoBehaviours that allow you to build Steam-driven UI in the Inspector without writing glue code.

The following features are fully covered end-to-end (API + Inspector components):

  • Core โ€” Application IDs, multi-app support (Main, Demo, Playtest), automated initialization, and DLC ownership/install/download-progress queries.
  • User โ€” Persona names, Steam levels, online status, rich presence, 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.

Foundation also ships the data-plumbing layer for a broader set of Steam features โ€” typed data structs and SteamTools events, but not yet dedicated components/high-level helpers (that ergonomic layer is what the Toolkit tier adds on top, matching the Foundation/Toolkit split used on the other engines):

  • Lobbies โ€” LobbyData/LobbyMemberData plus a full set of SteamTools events (enter, leave, invite, chat message, chat/data update, game-server, join request).
  • Steam Input โ€” InputActionData/InputActionSetData/InputActionStateData and action-set lookup helpers (SteamTools.GetSet/GetAction).
  • Steam Workshop โ€” WorkshopItemEditorData for authoring workshop item metadata.
  • Timeline โ€” TimelineEventData for the Steam Timeline API.

Requirements


Installation

Via Unity Package Manager (UPM)

  1. In Unity, go to Window > Package Manager.
  2. Click + > Add package from git URL.
  3. 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 โ€ฆ.


Setup & Workflow

1. Configuration

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.

2. Code Generation

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();

3. Initialisation

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");
}

Component Reference

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.

User & Achievements

ParentChild ComponentPurpose
SteamUserDataSteamUserNameDisplays persona name in a TMP label.
SteamUserStatusDisplays online/offline status.
SteamAchievementDataSteamAchievementIconDisplays achievement icon in a UI Image.
SteamAchievementChangedFires a UnityEvent on unlock.

Stats & Leaderboards

ParentChild ComponentPurpose
SteamLeaderboardDataSteamLeaderboardRankDisplays the local user's rank.
SteamLeaderboardDisplayPopulates a list/grid of leaderboard entries.

Usage Overview

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 */ });

Public Namespaces & Headers

NamespaceContents
Heathen.SteamworksIntegrationCore data types (UserData, AchievementData) and components.
Heathen.SteamworksIntegration.APILow-level static wrappers for Steam interfaces.
SteamToolsThe generated wrapper (Game, Interface, Events).