How do I add Steam to a Unity game with Steamworks.NET?
Do four things. Install the Steamworks.NET package. Add the SteamManager script to a GameObject in your first scene: it calls SteamAPI.Init() one time and SteamAPI.RunCallbacks() in each frame. Check SteamManager.Initialized before each Steam call. Then call the Steam function that you need, for example SteamUserStats.SetAchievement() and SteamUserStats.StoreStats().
Steamworks.NET is a C# wrapper for the Steamworks API of Valve, with the MIT license. Its README says that it stays as close as possible to the C++ API, so the Steamworks documentation of Valve also applies to it. A C++ call such as SteamUserStats()->SetAchievement() becomes SteamUserStats.SetAchievement() in C#.
Three conditions apply to the sample. The Steam client must run, with an account that owns the app. Steam must know your app ID. The achievement must exist in the Steamworks settings of your app, and you must have published those settings. ACH_FIRST_BOSS is an example name.
C#
// Needs the Steamworks.NET package and SteamManager.cs in the project (see below).
using UnityEngine;
using Steamworks;
public class FirstBoss : MonoBehaviour
{
public void OnBossDefeated()
{
if (!SteamManager.Initialized) return; // SteamAPI.Init() did not succeed
SteamUserStats.SetAchievement("ACH_FIRST_BOSS"); // unlock, in memory only
SteamUserStats.StoreStats(); // upload; this shows the pop-up
}
}Sources: Steamworks.NET documentation, Installation, Getting Started and SteamManager; Steamworks.NET repository, README; Steamworks documentation, ISteamUserStats.
Which Steamworks.NET, Steamworks SDK and Unity versions does this guide use?
Steamworks.NET 2025.165.0, built on Steamworks SDK 1.65, on Unity 2019.4 or later. Release 2025.165.0 has the date 29 October 2026, and it was the latest release on 19 November 2026. The README says: "Currently building against Steamworks SDK 1.65". The package.json of the package has the Unity version 2019.4.
The release notes and the FAQ give the Unity rule: from release 20.0.0, the minimum supported Unity version is the LTS release 2019.4. The FAQ adds that Steamworks.NET targets the oldest LTS release that Unity supports, and that version 15.0.1 was the last release for Unity 2019.3 and older. A fix in release 2025.165.0 names "Unity 7000 or newer", and the editor script has a note for Unity 6. We did not find a list of tested Unity versions.
From release 2024.8.0, the version number contains the SDK version: 2025.165.0 is SDK 1.65. The table gives the releases that the Releases page lists.
One change affects old tutorials: RequestCurrentStats. Valve marks it as deprecated, because the Steam client loads the stats and achievements of your game before launch. Steamworks.NET 2024.8.0 (SDK 1.60) still has SteamUserStats.RequestCurrentStats(). From 2025.161.0 (SDK 1.61) the function is not in the class: the source keeps only a comment that says the call is no longer required. The release notes do not name this change; we found it in the source of the two tags. Code that calls it does not compile on a current version, and you can delete the call.
Valve does not make this library. The Steamworks API Overview says that Unity has no native Steamworks support, and it lists two third-party solutions: Facepunch.Steamworks and Steamworks.NET.
| Steamworks.NET release | Steamworks SDK | Notes from the release |
|---|---|---|
| 20.0.0 | 1.52 | Unity Package Manager support. The minimum Unity version becomes 2019.4. Remove an older install completely before you upgrade. |
| 20.1.0 | 1.53 | The STEAMWORKS_NET define is added. |
| 20.2.0 | 1.57 | Fix for use in the Linux editor of Unity. |
| 2024.8.0 | 1.60 | The last release with SteamUserStats.RequestCurrentStats() (from the source of the tag). |
| 2025.161.0 | 1.61 | RequestCurrentStats() is no longer in SteamUserStats (from the source of the tag). |
| 2025.162.1 | 1.62 | The callback dispatcher resets on a Unity Domain Reload. |
| 2025.163.0 | 1.63 | Fix for a callback marshalling problem with Unity IL2CPP in ISteamMatchmakingResponses. |
| 2025.164.0 and 2025.164.1 | 1.64 | Fix for the size of SteamInputActionEvent_t. 2025.164.1 corrects the package version number. |
| 2025.165.0 | 1.65 | The version this guide targets. |
Sources: Steamworks.NET repository, README and Releases; Steamworks.NET source code, isteamuserstats.cs; Steamworks.NET documentation, Frequently Asked Questions; Steamworks documentation, ISteamUserStats and Steamworks API Overview.
What do I need before I start?
You need a Steamworks account with an app ID, the Steam client running with an account that owns the app, and a steam_appid.txt file while you develop. The Installation page says that you must already be a Steamworks developer to use Steamworks.NET.
steam_appid.txt tells Steam the app ID when the game does not start from the Steam client. Valve says that the file contains only the app ID and nothing else, that Steam looks for it in the current working directory, and that you must not ship it in your builds. The table gives the location for each case.
Without your own app ID, the file that Steamworks.NET writes contains 480. That is Spacewar, the example app of Valve. With 480 the Steam client shows you in Spacewar, and you cannot test your own achievements, because achievements belong to one app.
To upload the game you also need the official Steamworks SDK, for its ContentBuilder tool. Do not copy the Steam API files from that SDK into the project: the FAQ says that Steamworks.NET bundles the correct files, and that files from a different SDK version will lead to crashes.
| Case | Location of steam_appid.txt | Who puts it there |
|---|---|---|
| Unity editor | The root of the Unity project (next to the Assets folder). | The editor script of Steamworks.NET writes it with 480. You replace 480 with your app ID, save as ASCII or UTF-8 without a BOM, and start Unity again. |
| A build that you start from the executable | Next to the built .exe or .app. | You copy it. Steamworks.NET does not copy it into builds on purpose. |
| The build that you upload to Steam | No file. | You remove it. Steam gives the app ID when the game starts from the client. |
Sources: Steamworks.NET documentation, Installation and Frequently Asked Questions; Steamworks documentation, Steamworks API Overview.
How do I install Steamworks.NET in Unity?
Use the Unity Package Manager with the git URL from the Installation page: https://github.com/rlabrecque/Steamworks.NET.git?path=/com.rlabrecque.steamworks.net. That URL gets the latest code from the master branch. The page recommends a version at the end, and the release notes of 2025.165.0 give the full URL: https://github.com/rlabrecque/Steamworks.NET.git?path=/com.rlabrecque.steamworks.net#2025.165.0.
The Installation page gives three routes for Unity, as in the table. The example of a pinned version on that page still shows #20.0.0, which is a release from 2021. Use the tag of the current release.
The git package does not contain SteamManager.cs. Download the script from its own repository and put it in your Assets folder. The .unitypackage of release 2025.165.0 does contain it, at Assets/Scripts/Steamworks.NET/SteamManager.cs.
If the project has a Steamworks.NET version before 20.0.0, remove it completely first: the release notes say that the project structure changed for the Unity Package Manager. The same rule applies when you change from one install route to another.
- In Unity, open the Package Manager.
- Click the + button in the upper left of the window and select "Add package from git URL...".
- Enter https://github.com/rlabrecque/Steamworks.NET.git?path=/com.rlabrecque.steamworks.net#2025.165.0 and click Add.
- Download SteamManager.cs from the SteamManager repository and put it in the Assets folder.
- Open steam_appid.txt in the root of the project and replace 480 with your app ID.
- Close Unity and open the project again, so that it loads the new steam_appid.txt.
- Create an empty GameObject in your first scene and add the SteamManager script to it.
| Route | How | SteamManager.cs |
|---|---|---|
| Unity Package Manager | Add package from git URL, with the URL above and the release tag after #. | Not included. Download it from the SteamManager repository. |
| .unitypackage | Download Steamworks.NET_2025.165.0.unitypackage from the Releases page and import everything. The package goes into Assets/com.rlabrecque.steamworks.net. | Included. |
| Manual | Download the repository and copy the com.rlabrecque.steamworks.net folder into Assets with the file explorer, not by drag and drop into Unity. | Not included. Download it from the SteamManager repository. |
Sources: Steamworks.NET documentation, Installation and Getting Started; Steamworks.NET repository, Releases.
What does the SteamManager script do?
It starts Steam one time, runs the Steam callbacks in each frame, and shuts Steam down at the end. The documentation says that Steamworks.NET does nothing without a script of this type. SteamManager.cs is in the public domain, and the documentation expects you to change it for your game.
The order in Awake() is fixed. SteamAPI.RestartAppIfNecessary() is the first Steam call. If it returns true, Steam starts the game again from the client, and the script calls Application.Quit(). If steam_appid.txt is in the working directory, it returns false, so you can develop without a restart each time. This call is in a try block that catches DllNotFoundException, because it is the first place where a missing Steam API file shows.
SteamAPI.Init() is the second call. It returns true or false, and the script keeps the result in m_bInitialized, which the static property SteamManager.Initialized returns. Update() calls SteamAPI.RunCallbacks() only when the result was true. OnDestroy() calls SteamAPI.Shutdown().
The script is a singleton that creates itself: the first read of SteamManager.Initialized creates the GameObject if no SteamManager exists. DontDestroyOnLoad() keeps it for all scenes. The documentation tells you not to use SteamManager from Awake() or OnDestroy() of other scripts, because the execution order is not guaranteed.
One point differs between the two official texts. The SteamManager page shows SteamAPI.RestartAppIfNecessary((AppId)480). The script itself, version 1.0.12, has AppId_t.Invalid, and a comment that tells you to replace it with your app ID, for example (AppId_t)480, and to remove steam_appid.txt from the game depot. The type in Steamworks.NET 2025.165.0 is AppId_t.
The code below is a condensed version that shows this order. Use the official file in a real project: it also has the Packsize.Test() and DllCheck.Test() checks, the warning message hook, and the DISABLESTEAMWORKS switch that lets the project compile for platforms without Steam.
| Where | Call | What it does |
|---|---|---|
| Awake() | DontDestroyOnLoad(gameObject) | Keeps the one SteamManager for all scenes. A second instance destroys itself. |
| Awake() | Packsize.Test() and DllCheck.Test() | Log an error when the Steamworks.NET build or the Steam API file is the wrong version. The page says that DllCheck currently checks only steam_api.dll and steam_api64.dll. |
| Awake() | SteamAPI.RestartAppIfNecessary(appId) | True: the game did not start from Steam, so Steam starts it again and the script quits. False: continue. |
| Awake() | SteamAPI.Init() | Starts the Steam API. The result is SteamManager.Initialized. |
| OnEnable() | SteamClient.SetWarningMessageHook(hook) | Sends Steam warnings to the Unity log. You must start the game with -debug_steamapi to receive them. |
| Update() | SteamAPI.RunCallbacks() | Sends callbacks and call results to your functions. |
| OnDestroy() | SteamAPI.Shutdown() | Releases the Steam API when the game ends. |
C#: SteamManager.cs (condensed)
// SteamManager.cs: the core of the official SteamManager script (version 1.0.12), condensed.
// The official file also has the Packsize and DllCheck tests, the warning message hook,
// a reset for a disabled Domain Reload, and a build switch for platforms without Steam.
// Targets Steamworks.NET 2025.165.0 (Steamworks SDK 1.65). Desktop builds only.
using UnityEngine;
using Steamworks;
[DisallowMultipleComponent]
public class SteamManager : MonoBehaviour
{
private static SteamManager s_instance;
private bool m_bInitialized;
private static SteamManager Instance
{
get
{
if (s_instance == null)
{
return new GameObject("SteamManager").AddComponent<SteamManager>();
}
return s_instance;
}
}
public static bool Initialized
{
get { return Instance.m_bInitialized; }
}
private void Awake()
{
// Only one SteamManager, and it stays for all scenes.
if (s_instance != null)
{
Destroy(gameObject);
return;
}
s_instance = this;
DontDestroyOnLoad(gameObject);
try
{
// Replace AppId_t.Invalid with your own app ID before you ship, for example (AppId_t)480.
// Then a start from the executable makes Steam start the game again from the client.
if (SteamAPI.RestartAppIfNecessary(AppId_t.Invalid))
{
Application.Quit();
return;
}
}
catch (System.DllNotFoundException e)
{
// This is the first Steam call, so a missing Steam API file shows here.
Debug.LogError("[Steamworks.NET] Could not load the Steam API library.\n" + e, this);
Application.Quit();
return;
}
m_bInitialized = SteamAPI.Init();
if (!m_bInitialized)
{
Debug.LogError("[Steamworks.NET] SteamAPI_Init() failed.", this);
}
}
private void Update()
{
if (m_bInitialized)
{
SteamAPI.RunCallbacks();
}
}
private void OnDestroy()
{
if (s_instance != this) return;
s_instance = null;
if (m_bInitialized)
{
SteamAPI.Shutdown();
}
}
}Sources: Steamworks.NET documentation, SteamManager; Steamworks.NET SteamManager script, SteamManager.cs; Steamworks documentation, Steamworks API Overview.
How do I check that Steam is initialised and read the player name and Steam ID?
Read SteamManager.Initialized, then call SteamFriends.GetPersonaName() and SteamUser.GetSteamID(). The Getting Started page says to always check SteamManager.Initialized before a Steamworks function. When it is false, do nothing, and the same build also runs without Steam.
GetPersonaName() returns the display name of the current user, the same name as on the community profile. GetSteamID() returns a CSteamID struct, and its field m_SteamID is the 64-bit ID as a ulong. SteamUtils.GetAppID() returns the app ID that Steam uses for this run, so the log shows fast if the game runs as 480 and not as your app.
When the game starts, the Steam client should show you as in-game. That is the first test that the Getting Started page gives.
C#
// SteamHello.cs: add it to any GameObject.
using UnityEngine;
using Steamworks;
public class SteamHello : MonoBehaviour
{
private void Start()
{
if (!SteamManager.Initialized) return;
string personaName = SteamFriends.GetPersonaName();
CSteamID steamId = SteamUser.GetSteamID();
AppId_t appId = SteamUtils.GetAppID();
// m_SteamID is the 64-bit Steam ID as a ulong.
Debug.Log("Steam user " + personaName + ", Steam ID " + steamId.m_SteamID + ", app " + appId);
}
}Sources: Steamworks.NET documentation, Getting Started; Steamworks documentation, ISteamFriends (GetPersonaName), ISteamUser (GetSteamID) and ISteamUtils.
How do I unlock an achievement and set a stat in C#?
Set, then store. SteamUserStats.SetAchievement() unlocks the achievement in the memory of Steam only. SteamUserStats.StoreStats() sends the change to the server and shows the notification. Valve says that StoreStats is required to display the notification, so call it soon after SetAchievement().
First define the achievements and stats in the Steamworks settings of your app, and publish the changes. The string in your C# code is the API Name, not the display name. Valve says that SetAchievement, GetAchievement, SetStat and GetStat return false when the API name does not exist or the changes are not published. The GodotSteam guide in the links has the Steamworks steps and the three stat types; they are the same for Unity.
Stats use two overloads. SetStat(name, int) and GetStat(name, out int) are for an INT stat; SetStat(name, float) and GetStat(name, out float) are for a FLOAT stat. The type must match the type in Steamworks, or the call returns false. The value is absolute: Valve says that Steam does not increment or decrement for you. So to add 1, read the value, add 1, and write the total.
Do not call StoreStats() often. Valve says that the call can be rate limited, and that the frequency should be on the order of minutes, not seconds: the end of a round, a map change or a checkpoint. The set calls are cheap, and Valve says that Steam keeps their values if the game crashes.
On Steamworks.NET 2025.165.0 you read and write directly after SteamAPI.Init(). There is no RequestCurrentStats() call and no wait for a UserStatsReceived_t callback for the current player. For a progress pop-up, SteamUserStats.IndicateAchievementProgress() takes the API name, the current progress and the maximum; Valve says that it does not set the progress and does not unlock the achievement.
C#
// SteamAchievements.cs: static helpers for achievements and stats.
using UnityEngine;
using Steamworks;
public static class SteamAchievements
{
public static void Unlock(string apiName)
{
if (!SteamManager.Initialized) return;
// Step 1: set. This changes only the in-memory state of Steam.
if (!SteamUserStats.SetAchievement(apiName))
{
Debug.LogWarning("No published Steam achievement has the API name " + apiName);
return;
}
// Step 2: store. This uploads the unlock and shows the overlay notification.
if (!SteamUserStats.StoreStats())
{
Debug.LogWarning("StoreStats() failed. Are the stats of this app published?");
}
}
public static bool IsUnlocked(string apiName)
{
if (!SteamManager.Initialized) return false;
// The return value: the API name exists and is published. achieved: the player has it.
return SteamUserStats.GetAchievement(apiName, out bool achieved) && achieved;
}
public static void AddToIntStat(string apiName, int amount = 1)
{
if (!SteamManager.Initialized) return;
// SetStat() takes the new total, so read the current value first.
if (!SteamUserStats.GetStat(apiName, out int total))
{
Debug.LogWarning("Steam has no published INT stat with the API name " + apiName);
return;
}
if (!SteamUserStats.SetStat(apiName, total + amount))
{
Debug.LogWarning("Steam refused the INT stat " + apiName);
}
}
public static void SetFloatStat(string apiName, float value)
{
if (!SteamManager.Initialized) return;
if (!SteamUserStats.SetStat(apiName, value))
{
Debug.LogWarning("Steam refused the FLOAT stat " + apiName);
}
}
public static float GetFloatStat(string apiName)
{
if (!SteamManager.Initialized) return 0f;
return SteamUserStats.GetStat(apiName, out float value) ? value : 0f;
}
// Call this at a checkpoint or at the end of a level, not on each frame.
public static void Save()
{
if (SteamManager.Initialized && !SteamUserStats.StoreStats())
{
Debug.LogWarning("StoreStats() failed");
}
}
}
// From the game:
// SteamAchievements.Unlock("ACH_FIRST_BOSS");
// SteamAchievements.AddToIntStat("STAT_ENEMIES_DEFEATED");
// SteamAchievements.SetFloatStat("STAT_BEST_LAP_SECONDS", 83.4f);
// SteamAchievements.Save();Sources: Steamworks documentation, ISteamUserStats (SetAchievement, GetAchievement, SetStat, GetStat, StoreStats, IndicateAchievementProgress, RequestCurrentStats) and Stats and Achievements; Steamworks.NET source code, isteamuserstats.cs.
How do Callback<T> and CallResult<T> work in Steamworks.NET?
A Callback<T> listens for an event that Steam sends to every listener. A CallResult<T> receives the answer to one function call. Both arrive only while SteamAPI.RunCallbacks() runs, which SteamManager does in Update().
For a callback, declare a Callback<T> field in the class and create it with Callback<T>.Create(function). The Getting Started page says that the field prevents the garbage collector from removing the callback, and that OnEnable() is the usual place, because Unity then creates it again after an assembly reload.
For a call result, look at the return type. The page says that a function which returns SteamAPICall_t needs a CallResult. Create it with CallResult<T>.Create(function), call the Steam function, and give the handle to Set(). The function of a call result has one more argument than a callback: bool bIOFailure.
The example listens for two callbacks. UserStatsStored_t arrives after StoreStats(); Valve says that the result k_EResultInvalidParam means the server rejected one or more stats and sent back its own values. UserAchievementStored_t arrives for an unlock or a progress notification: when m_nCurProgress and m_nMaxProgress are both zero, the achievement is fully unlocked. The call result is the one from the Getting Started page: SteamUserStats.GetNumberOfCurrentPlayers().
| Callback<T> | CallResult<T> | |
|---|---|---|
| What it receives | An event that Steam broadcasts, for example GameOverlayActivated_t. | The result of one call that returns SteamAPICall_t, for example GetNumberOfCurrentPlayers(). |
| Create | Callback<T>.Create(function) | CallResult<T>.Create(function) |
| Connect to a call | Not needed. | Set(handle), with the SteamAPICall_t handle that the call returned. |
| Function arguments | (T pCallback) | (T pCallback, bool bIOFailure) |
| Needs | SteamAPI.RunCallbacks() in each frame. | SteamAPI.RunCallbacks() in each frame. |
C#
// SteamStatsListener.cs: add it to a GameObject that stays enabled.
using UnityEngine;
using Steamworks;
public class SteamStatsListener : MonoBehaviour
{
// Keep each Callback and CallResult in a field, or the garbage collector removes it.
protected Callback<UserStatsStored_t> m_UserStatsStored;
protected Callback<UserAchievementStored_t> m_UserAchievementStored;
private CallResult<NumberOfCurrentPlayers_t> m_NumberOfCurrentPlayers;
// OnEnable, so Unity creates them again after it reloads the assemblies.
private void OnEnable()
{
if (!SteamManager.Initialized) return;
m_UserStatsStored = Callback<UserStatsStored_t>.Create(OnUserStatsStored);
m_UserAchievementStored = Callback<UserAchievementStored_t>.Create(OnUserAchievementStored);
m_NumberOfCurrentPlayers = CallResult<NumberOfCurrentPlayers_t>.Create(OnNumberOfCurrentPlayers);
}
// A callback: Steam sends it to every listener, after StoreStats().
private void OnUserStatsStored(UserStatsStored_t pCallback)
{
if (pCallback.m_eResult != EResult.k_EResultOK)
{
// k_EResultInvalidParam: Steam rejected one or more stats and sent back its values.
Debug.LogWarning("Steam did not store the stats: " + pCallback.m_eResult);
}
}
private void OnUserAchievementStored(UserAchievementStored_t pCallback)
{
if (pCallback.m_nCurProgress == 0 && pCallback.m_nMaxProgress == 0)
{
Debug.Log("Unlocked on Steam: " + pCallback.m_rgchAchievementName);
}
else
{
Debug.Log("Progress on " + pCallback.m_rgchAchievementName + ": " + pCallback.m_nCurProgress + " of " + pCallback.m_nMaxProgress);
}
}
// A call result: the answer to one call. The function returns a SteamAPICall_t handle.
public void RequestPlayerCount()
{
if (!SteamManager.Initialized) return;
SteamAPICall_t handle = SteamUserStats.GetNumberOfCurrentPlayers();
m_NumberOfCurrentPlayers.Set(handle);
}
private void OnNumberOfCurrentPlayers(NumberOfCurrentPlayers_t pCallback, bool bIOFailure)
{
if (pCallback.m_bSuccess != 1 || bIOFailure)
{
Debug.LogWarning("Steam did not return the number of current players.");
return;
}
Debug.Log("Players in the game now: " + pCallback.m_cPlayers);
}
}Sources: Steamworks.NET documentation, Getting Started (Steam Callbacks, Steam CallResults) and SteamManager; Steamworks documentation, Steamworks API Overview and ISteamUserStats (Callbacks).
How do I use the Steam overlay in a Unity game?
You do not write code to show it: Valve says that the overlay hooks into any game that starts from Steam. Code is for two things: to know when it opens, with the GameOverlayActivated_t callback, and to open it yourself, with SteamFriends.ActivateGameOverlay().
In the Unity editor the overlay is not reliable. The Steamworks.NET FAQ says that it does not function well, or often at all, in the editor. The FAQ also explains builds that you start from the executable: the overlay must be injected before the renderer starts, and Unity scripts run after that. A game that starts from the Steam client gets the overlay. So set your app ID in SteamAPI.RestartAppIfNecessary(), and test the overlay with a build that Steam starts.
ActivateGameOverlay() takes the name of a dialog. Valve lists: friends, community, players, settings, officialgamegroup, stats and achievements. SteamUtils.IsOverlayEnabled() returns false for the first seconds while the overlay loads. Valve suggests the callback as the moment to pause a single player game.
If your pause stops the Update() of SteamManager, the callbacks stop too. The SteamManager page says to make sure that SteamAPI.RunCallbacks() still runs while the game is paused. On macOS, Valve says that overlay support for 10.15 requires entitlements in the build configuration.
C#
// SteamOverlay.cs: know when the overlay is open, and open it from a menu button.
using UnityEngine;
using Steamworks;
public class SteamOverlay : MonoBehaviour
{
public static bool IsOpen { get; private set; }
protected Callback<GameOverlayActivated_t> m_GameOverlayActivated;
private void OnEnable()
{
if (!SteamManager.Initialized) return;
m_GameOverlayActivated = Callback<GameOverlayActivated_t>.Create(OnGameOverlayActivated);
}
private void OnGameOverlayActivated(GameOverlayActivated_t pCallback)
{
// m_bActive is a byte: not 0 when the overlay opens, 0 when it closes.
IsOpen = pCallback.m_bActive != 0;
// Pause a single player game here while IsOpen is true.
}
public void OpenAchievements()
{
if (!SteamManager.Initialized || !SteamUtils.IsOverlayEnabled()) return;
// Valid dialogs: friends, community, players, settings, officialgamegroup, stats, achievements.
SteamFriends.ActivateGameOverlay("achievements");
}
}Sources: Steamworks.NET documentation, Frequently Asked Questions, Getting Started and SteamManager; Steamworks documentation, Steam Overlay, ISteamFriends (ActivateGameOverlay) and ISteamUtils (IsOverlayEnabled).
Which other Steam features can I add: cloud saves, leaderboards and rich presence?
Cloud saves need no code with Steam Auto-Cloud. Leaderboards and rich presence need a few calls. This guide does not show code for the three; the table names the Steamworks.NET class and the Valve page for each one, and the Sources list has the links.
Valve describes Steam Auto-Cloud as a way to use Steam Cloud without code and without a change to the game: you specify the groups of files in the Steamworks settings, and Steam syncs them when the game starts and exits. Valve recommends the Cross-Platform setting for new root paths, also for a game on one platform.
Leaderboard calls return a SteamAPICall_t handle, so each one needs a CallResult<T>, as in the section above. Valve says that one title can create up to 10,000 leaderboards, and that each entry has an int32 score.
| Feature | Code in the game | Steamworks.NET class and example function | Valve page |
|---|---|---|---|
| Cloud saves | None with Steam Auto-Cloud. The Steam Cloud API is the route with code. | SteamRemoteStorage (only for the Cloud API) | Steam Cloud |
| Leaderboards | Find or create the leaderboard, then upload a score. Each call needs a CallResult<T>. | SteamUserStats.FindOrCreateLeaderboard(), SteamUserStats.UploadLeaderboardScore() | Steam Leaderboards |
| Rich presence | Set the steam_display key. Its value names a localization token, and Valve documents the tokens under Rich Presence Localization. | SteamFriends.SetRichPresence(key, value) | Enhanced Rich Presence |
Sources: Steamworks documentation, Steam Cloud, Steam Leaderboards and Enhanced Rich Presence; Steamworks.NET source code, tag 2025.165.0.
Which platforms does Steamworks.NET support: Windows, macOS, Linux, Steam Deck and IL2CPP?
Windows (32 and 64 bit), macOS and Linux: the README says that Steamworks.NET fully supports the three. The FAQ says that it supports the combination of all platforms that Unity and Steam both support. The package ships the Steam API file for each one as a Unity plugin: steam_api.dll and steam_api64.dll for Windows, libsteam_api.so for Linux, and steam_api.bundle for macOS.
SteamManager.cs 1.0.12 compiles its Steam code only for the Windows, Linux and macOS standalone targets. On other targets it defines DISABLESTEAMWORKS, and SteamManager.Initialized is always false. The FAQ says that you can also set DISABLESTEAMWORKS yourself in the Player Settings, and that you then must put your own Steam calls in #if blocks.
Steam Deck has no section in the Steamworks.NET documentation, so this guide makes no Steam Deck claim for the library. One related API changed: Valve marks ISteamUtils IsSteamRunningOnSteamDeck as deprecated as of Steamworks SDK 1.65, and the SteamUtils class of Steamworks.NET 2025.165.0 has IsRunningOnSteamHardware() and no IsSteamRunningOnSteamDeck().
IL2CPP also has no page in the documentation. Two facts are on record: release 2025.163.0 fixed a callback marshalling problem with Unity IL2CPP, and SteamManager.cs puts the AOT.MonoPInvokeCallback attribute on its warning hook. We did not build with IL2CPP for this guide. The FAQ has one more build limit: the Steam DRM wrapper does not work well with Unity games.
The 2025.165.0 package also has plugin folders with the names linuxarm64 and androidarm64, and release 2025.164.0 lists a change for Android platform support. The README and the FAQ do not describe these targets, so we do not describe them.
Sources: Steamworks.NET repository, README and Releases; Steamworks.NET documentation, Frequently Asked Questions; Steamworks.NET SteamManager script, SteamManager.cs; Steamworks documentation, ISteamUtils.
What are the alternatives to Steamworks.NET for Unity?
Two are common: Facepunch.Steamworks and the Heathen toolkit. Facepunch.Steamworks is a separate C# library with the MIT license. Its README lists support for Windows, Linux, macOS, Unity and Unity IL2CPP, and describes a single C# dll with no native files apart from those of Steam. Its API is not a copy of the C++ API: the README shows properties such as SteamClient.SteamId and SteamClient.Name. Valve lists it next to Steamworks.NET as a third-party solution for Unity. Heathen Engineering publishes Foundation for Steamworks for Unity, with the Apache 2.0 license. It is not a replacement: its README calls it an integration layer for Steamworks.NET, with components and a generated wrapper for user data, stats, achievements and leaderboards, and its badge says Unity 6 or later. Heathen also sells a paid Toolkit that builds on it. Steamworks.NET is the route with the names of the Valve documentation, which is why this guide uses it. We did not test the two alternatives.
Sources: Facepunch.Steamworks repository, README; Heathen Engineering, Foundation for Steamworks for Unity README; Steamworks documentation, Steamworks API Overview.
How do I test and reset achievements during development?
Call SteamUserStats.ResetAllStats(true) to reset all stats and all achievements of the current player, or ClearAchievement() and then StoreStats() for one achievement. Valve says that ResetAllStats stores the change on its own, and that it is typically only for tests during development.
Valve also documents two commands for the Steam client console, with no code in your game. Start Steam with steam.exe -console, then use achievement_clear with the app ID and the achievement name, or reset_all_stats with the app ID.
You can test in the Unity editor: the FAQ says that Steamworks.NET works there, apart from the overlay. Without the overlay you do not see the pop-up, so use the UserAchievementStored_t callback from the section above as the proof of the unlock. After a test in the editor, Steam can still show you as in-game: the FAQ says that Steam sees a game as closed only when the last dependent process has quit, and that this is normal.
Before release, Valve says that you can preview your achievements on your own Steam achievements page, linked from the top of the achievements editor. For store problems, Valve points to the file logs\stats_log.txt in the Steam install folder.
C# and Steam console
// SteamDevTools.cs: only in the editor and in development builds.
#if UNITY_EDITOR || DEVELOPMENT_BUILD
using UnityEngine;
using Steamworks;
public static class SteamDevTools
{
public static void ResetEverything()
{
// true: reset the achievements too. Steam stores the change for you.
if (SteamManager.Initialized && !SteamUserStats.ResetAllStats(true))
{
Debug.LogWarning("ResetAllStats() failed");
}
}
public static void Relock(string apiName)
{
if (SteamManager.Initialized && SteamUserStats.ClearAchievement(apiName))
{
SteamUserStats.StoreStats();
}
}
}
#endif
// Or, with no code, in the Steam client console (start Steam with: steam.exe -console):
// achievement_clear <appid> <achievement name>
// reset_all_stats <appid>Sources: Steamworks documentation, ISteamUserStats (ResetAllStats, ClearAchievement, StoreStats), Stats and Achievements and Step by Step: Achievements; Steamworks.NET documentation, Frequently Asked Questions.
Why does SteamAPI.Init fail, or why does my achievement not show?
SteamAPI.Init() fails most often because the Steam client is not running or because Steam cannot find the app ID. An achievement that does not show is most often not published, or the game set it and did not store it. The table lists the causes that Valve and the Steamworks.NET documentation give.
Read the Unity log first. SteamManager writes one of three errors: "SteamAPI_Init() failed", "Could not load [lib]steam_api.dll/so/dylib", or a failed Packsize or DllCheck test. Then check the return values: a false from SetAchievement() points to the API name or to publishing.
For more detail on a failed start, SteamAPI.InitEx(out string) in Steamworks.NET 2025.165.0 returns an ESteamAPIInitResult and an error message. The values are OK, FailedGeneric, NoSteamClient and VersionMismatch. SteamManager.cs 1.0.12 uses SteamAPI.Init(), which returns only true or false.
| Cause | How to see it | Fix |
|---|---|---|
| Steam is not running | SteamAPI.Init() returns false. The log has "SteamAPI_Init() failed". | Start the Steam client and sign in before you start the game. |
| The app ID file is missing | SteamAPI.Init() returns false in a build that you start from the executable. | Put steam_appid.txt next to the executable, with the app ID and nothing else. In the editor it goes in the project root. |
| The account does not own the app, or the app is not set up | SteamAPI.Init() returns false with Steam running and the file present. | The app must show in your Steam library. Valve also lists a different OS user or admin level than the Steam client. |
| The Steam API file is missing: DllNotFoundException | The log has "Could not load [lib]steam_api.dll/so/dylib", and SteamManager quits the game. | Install the package again. Check that the Steam API file for your platform is in the build. |
| The Steam API file is the wrong version or architecture | The log has a failed DllCheck or Packsize test, or the game crashes. | Use the files that Steamworks.NET bundles, not files from another SDK version. Delete old steam_api.dll and steam_api64.dll files in the project root: the editor script logs an error for them. |
| Callbacks never fire | The Steam calls return true, but your callback functions do not run. The pop-up shows only after you quit the game. | Make sure that SteamAPI.RunCallbacks() runs in each frame, also while the game is paused. Keep each Callback<T> in a field. |
| The achievement or stat is not published | SetAchievement() or SetStat() returns false. | Publish the changes in the Steamworks settings of the app. |
| The API name is wrong | The same false results, for one name only. | Copy the API Name from Steamworks. The display name does not work. |
| The game set it and did not store it | No notification. GetAchievement() gives achieved true. | Call SteamUserStats.StoreStats() after SetAchievement(). |
| The overlay does not work | The UserAchievementStored_t callback arrives, but there is no pop-up, usually in the editor. | Test a build that starts from the Steam client. |
| The game runs as Spacewar | Steam shows you in Spacewar, and your API names do not exist. | Replace 480 in steam_appid.txt with your app ID and start Unity again. |
Sources: Steamworks documentation, Steamworks API Overview (SteamAPI_Init) and ISteamUserStats; Steamworks.NET documentation, SteamManager and Frequently Asked Questions; Steamworks.NET SteamManager script, SteamManager.cs.
What do Steam achievements and stats tell you, and what do they not?
They tell you what share of all owners reached a point, and they tell the player what they did. After release, Steam shows a page of global achievement statistics for your game: the percentage of players who have each achievement, from the most common to the rarest. Valve calls it a resource for the developer: are your special challenges hard enough, or too hard?
That page is public, for your game and for every other game. Progress achievements in order (chapter 1, chapter 2, the end) give a rough completion funnel with no extra code.
They do not tell you who the players are or when they played. A global percentage is one number for all players and all time. It has no split by traffic source, by cohort, by build or by country, no session length, and no step between two achievements. Stats are written by the game client, and Valve says that this data can be manipulated. Achievements also answer only the questions that you made into achievements before launch.
So use achievements for players first. Use them as a free signal second, and do not make them your only measurement.
Sources: Steamworks documentation, Stats and Achievements (The Steam Community, Global Stats).
How do I add analytics next to Steamworks.NET in a Unity game?
Send an event at the moment of the unlock. The Manalens Unity SDK is a Unity Package Manager package in plain C#, with no native code, and it needs Unity 2021.3 or later. It runs next to Steamworks.NET in the same project. Its Track() function takes a snake_case event name and a dictionary of flat properties, so one line records which achievement a player unlocked, in which session and in which build.
achievement_unlocked is a custom event name in this example. It is not one of the events that the SDK sends on its own, and it is not in the standard event conventions. The standard events are level_start, level_complete and level_fail, and the SDK sends game_open and session_start for you. The SDK does not read Steam: it does not import achievements or stats, and it does not use the Steam ID.
The example does not show the start of the SDK. You call Manalens.Init() one time with your Publishable key, and the Storefront option takes the value steam. The Unity integration page in the links has the install steps and the full Init() example.
With the events in place, a funnel shows the drop between two steps, retention shows who returns, and the App filters compare one build with the next. If players come from your website, install attribution links the first launch to a website visit. Steam achievements stay what the player sees; the events are what you read.
- Install game analytics in Unity →
- How to add analytics to a Unity game →
- How to move from Unity Analytics to Manalens →
- What events to track first in your game →
- Funnels →
- Retention →
C#
// AchievementEvents.cs: with the Manalens Unity SDK started in your first scene.
using System.Collections.Generic;
using ManalensSdk;
public static class AchievementEvents
{
public static void UnlockAndTrack(string apiName)
{
if (!SteamManager.Initialized) return;
bool isNew = !SteamAchievements.IsUnlocked(apiName);
SteamAchievements.Unlock(apiName);
if (isNew)
{
// A custom event. The name and the property are your choice.
Manalens.Track("achievement_unlocked", new Dictionary<string, object> { ["achievement"] = apiName });
}
}
}Sources: Manalens Unity SDK and app events documentation.
How do I start?
Manalens is the analytics and growth engine built for games. Add Steamworks.NET for the Steam features, add the Unity SDK for events, and read both: Steam for the global percentages, the Game KPIs board for retention, sessions and level results by build.
Sources: Manalens Unity SDK documentation.
Frequently asked questions
Do I still need RequestCurrentStats() in Steamworks.NET?
No. Valve marks RequestCurrentStats as deprecated, because the Steam client loads stats and achievements before launch. Steamworks.NET 2024.8.0 on SDK 1.60 still has the function. From release 2025.161.0 on SDK 1.61, SteamUserStats does not have it, so old code does not compile. Delete the call, and read with GetAchievement() and GetStat() directly after SteamAPI.Init().
Which Unity versions does Steamworks.NET support?
Unity 2019.4 or later. The release notes say that from release 20.0.0 the minimum supported Unity version is the LTS release 2019.4, and the package.json of release 2025.165.0 has the same value. The FAQ says that version 15.0.1 was the last release for Unity 2019.3 and older. We did not find a list of tested versions.
Why does SteamAPI.Init() return false in Unity?
Valve gives five causes. The Steam client is not running. Steam cannot find the app ID, so steam_appid.txt is missing from the working directory. The game runs under a different OS user or admin level than Steam. The account does not own a license for the app. Or the app ID is not completely set up.
Where does steam_appid.txt go in a Unity project?
In the root of the Unity project for the editor, and next to the built executable for a build that you start outside Steam. The Steamworks.NET editor script writes the file with 480 in the project root; you replace 480 with your app ID. Do not ship the file: Valve says to remove it from the build that you upload.
Why does the achievement pop-up show only after I quit the game?
The Steamworks.NET FAQ gives two likely causes: the game does not call SteamAPI.RunCallbacks() at regular intervals, or it does not call SteamUserStats.StoreStats() after it sets the achievement. Check that the SteamManager GameObject is active and that its Update() runs. Then call StoreStats() directly after SetAchievement(), because Valve requires it for the notification.
Is Steamworks.NET free, and does Valve support it?
It is free, with the MIT license, and the author asks for a donation or a credit if it helps you make money. Valve does not make or endorse it. The Steamworks API Overview lists Unity with no native Steamworks support, and names Steamworks.NET and Facepunch.Steamworks as third-party solutions that Valve says it does not endorse.
Sources and implementation
- Steamworks.NET documentation: Installation (read 19 November 2026) ↗
- Steamworks.NET documentation: SteamManager (read 19 November 2026) ↗
- Steamworks.NET documentation: Getting Started (read 19 November 2026) ↗
- Steamworks.NET documentation: Frequently Asked Questions (read 19 November 2026) ↗
- Steamworks.NET repository: README (GitHub, read 19 November 2026) ↗
- Steamworks.NET repository: Releases, with release 2025.165.0 of 29 October 2026 (GitHub, read 19 November 2026) ↗
- Steamworks.NET source code: isteamuserstats.cs, tag 2025.165.0 (GitHub, read 19 November 2026) ↗
- Steamworks.NET SteamManager script: SteamManager.cs, version 1.0.12 (GitHub, read 19 November 2026) ↗
- Steamworks documentation: Steamworks API Overview (Valve, read 19 November 2026) ↗
- Steamworks documentation: ISteamUserStats interface (Valve, read 19 November 2026) ↗
- Steamworks documentation: Stats and Achievements (Valve, read 19 November 2026) ↗
- Steamworks documentation: Step by Step: Achievements (Valve, read 19 November 2026) ↗
- Steamworks documentation: ISteamFriends interface (Valve, read 19 November 2026) ↗
- Steamworks documentation: ISteamUser interface (Valve, read 19 November 2026) ↗
- Steamworks documentation: ISteamUtils interface (Valve, read 19 November 2026) ↗
- Steamworks documentation: Steam Overlay (Valve, read 19 November 2026) ↗
- Steamworks documentation: Steam Cloud (Valve, read 19 November 2026) ↗
- Steamworks documentation: Steam Leaderboards (Valve, read 19 November 2026) ↗
- Steamworks documentation: Enhanced Rich Presence (Valve, read 19 November 2026) ↗
- Facepunch.Steamworks repository: README (GitHub, read 19 November 2026) ↗
- Heathen Engineering: Foundation for Steamworks for Unity, README (Codeberg, read 19 November 2026) ↗