Configure your Unity project for the Steamworks API
Set up your Steamworks account, import the Steamworks SDK, and link your application ID to prepare your Unity project for the Steamworks API.
Prerequisites
A Unity project (6000.0 and later) with the Steamworks API package installed.
Configure your project
To configure your project for the Steamworks API, complete the following tasks:
- Set up your Steamworks account and application
- Download the Steamworks SDK
- Import the Steamworks SDK into your project
- Link your Steamworks application to your Unity project
1. Set up your Steamworks account and application
On the Steamworks partner website, set up a Steamworks account and then register your application to get the application ID.
- To set up a Steamworks account, follow the instructions on the Getting Started page (Valve).
- To register your application, follow the instructions on the Applications page (Valve).
2. Download the Steamworks SDK
The Steamworks API package doesn't ship the Steamworks SDK libraries. Download the Steamworks SDK from the SDK Releases page and extract the download. The current version of the Steamworks API package supports only Steamworks SDK version 1.65.
3. Import the Steamworks SDK into your project
In the Unity Editor, import the Steamworks libraries from the downloaded SDK. This copies the three Steamworks API libraries into the Assets/Plugins/Steamworks folder of your project, one for each supported platform: Windows, macOS, and Linux. Unity automatically loads the correct library for your operating system in the Unity Editor and includes only the matching library when you build a Player.
Note
You can move the libraries anywhere under Assets. The package detects the libraries unless you change their plug-in platform settings. If a library is missing or misconfigured, the Editor logs a warning at startup that lists the state of each library. The import process doesn't take into account the moved libraries. When you update the SDK, Unity always imports the libraries into Assets/Plugins/Steamworks, even if you moved the previous libraries. Before you update to a newer SDK, delete the moved libraries. If you don't delete the libraries, your project contains two sets of the same libraries and the Editor displays an error in the Console window.
You can import the SDK either in the Project Settings window or from the command line.
Import from the Project Settings window
- Open the Project Settings window (menu: Edit > Project Settings).
- Open the Steamworks category.
- Select Locate Steamworks SDK. In the Locate Steamworks SDK dialog, select the extracted SDK folder. You can select any folder that contains the
redistributable_binfolder of the SDK.
Unity imports the SDK into Assets/Plugins/Steamworks and the Steamworks category in the Project Settings window shows the Steamworks SDK imported message. The button label changes to Update Steamworks SDK. To update the SDK, repeat these steps. The package supports only Steamworks SDK version 1.65.
Import from the command line
Use the command line to set up a project without opening the Unity Editor interface, such as for testing or when preparing a project with assemblies from batch mode. The command line imports the SDK only into a project that doesn't already have Steamworks libraries. The import works the same way as in the Project Settings window.
Locate the Unity Editor executable for the version your project uses, for example
Unity.exein the Editor installation folder on Windows.Launch the Editor from a terminal or command prompt, passing
-projectPathto specify your project and-steamworksSdkPathto specify your SDK folder:Unity.exe -projectPath C:\MyProject -steamworksSdkPath=C:\SteamworksSDKAfter the Editor finishes loading, Unity imports the SDK automatically. To update the SDK, use Update Steamworks SDK in the Project Settings window.
4. Link your Steamworks application to your Unity project
- Go to Edit > Project Settings > Steamworks.
- In the App Id field, enter the application ID from step 1.
- Select Write steam_appid.txt to the project root for Play mode to create a
steam_appid.txtfile with that application ID in your project root.
Your project is now configured to use the Steamworks API.
Before you make your first API call, ensure the Steam client is running on your machine and you're signed into it. SteamAPI.Init requires this to succeed. For more information, refer to Initialize and shut down the Steamworks API.
Import the sample project
You can import the Hello Steam sample project that demonstrates how to initialize the Steamworks API and integrate identity, subscribe to callbacks, and unlock achievements. To access this sample:
- Go to Window > Package Management > Package Manager.
- In the packages list view, select the Steamworks API package.
- In the package details view, select the Samples tab.
- Select Import.
Unity imports the sample into the Assets/Samples folder of your Unity project.