Steamworks API package components
The Steamworks API package is a C# wrapper for the Steamworks SDK. It has three main components: C# API layer, the initialization and shutdown methods, and the callback system.
C# API layer
The package directly wraps the C++ Steamworks SDK so you can access it in Unity. Unity generates the C# class names and signatures from the SDK's steam_api.json file, so they match the Steamworks API.
The package provides one static class per Steamworks interface, such as SteamUser, SteamFriends, SteamUserStats, and SteamNetworkingSockets, along with the structs, enumerations, and constants that match the SDK exactly.
Initialization and shutdown
Use the package to initialize the Steamworks API when your application starts and close the connection when you no longer need it. Use one set of APIs for a client application and another for a game server:
- Client application:
SteamAPI.Initinitializes the Steamworks API and connects your application to the Steam client, the desktop application the user installs and signs in to.SteamAPI.Shutdowncloses the connection. - Game server:
GameServer.InitExinitializes the Steamworks API when you run a game server, such as when hosting a multiplayer game.GameServer.Shutdowncloses the connection.
For more information, refer to Initialize and shut down the Steamworks API.
Callback system
The package delivers asynchronous messages from the Steamworks API to your application. Use the SteamCallbacks class to process the callback queue and perform the following:
- Subscribe to specific callbacks by using the generated struct types
- Await asynchronous call results as
Taskobjects - Observe all messages that pass through the queue
For more information, refer to Callbacks and call results.
Additional resources
- Steamworks SDK (Valve)
- Steamworks API reference (Valve)