Comment on page
The most important part
Steamworks Behaviour simply initializes the Steam API for you and exposes common events to the Unity Inspector. As of version 2.30.12 Steamworks Behaviour no longer runs the callback loop. We have made it such that Steam API can be initialized and ran without using any component scripts. That said most uses cases will greatly benifit from using Steamworks Behaviour in their bootstrap scene.
You should add a Steamworks Behaviour component to a game object in the first scene to be loaded by your game. It is important that this game object is never destroyed as it is operating your Steam API integration. We do recommend you use additive loading and simply never unload your bootstrapping scene however you can use the Do Not Destroy approach if you are carful to NEVER reload the scene that defined Steamworks Behaviour.
The Steamworks behaviour is not intended to be a functional component that is you will not interact with this component, it exists wholly to initialize, operate and shutdown the Steam API integration according to Unity events. The one exception to this case is when operating a Steam Game Server in a situation where you need to delay API initialization. You can optionally configure your Steam Settings to NOT auto initialize Steam Game Server, in which case you will need to call SteamworksBeahviour.InitializeGameServer in order to kick off the initialization process.
This is rare and in general you should be allowing the system to auto initialize.
public UnityEvent evtSteamInitialized;
This is invoked when Steam API is fully initialized and all artifacts are ready for use.
This event has no parameters, a handler for this event would like:
public void HandleEvent()
public UnityStringEvent evtSteamInitializationError;
This is invoked if the Steam API fails to initialize.
This event has 1 parameter of type string which is a message indicating why it failed to initialize. A handler for this event would look like:
public void HandleEvent(string errorMessage)
public LobbyDataEvent evtLobbyInviteArgumentDetected;
This is invoked after initialization completes if the system detects a lobby ID was passed in on the command line arguments. This occurs when a user accepted a lobby invite but was not currently playing the game. In that use case Steam will launch the game with the lobby ID on the command line.
public void HandleEvent(Lobby lobby)
public SteamSettings settings;
public static void CreateIfMissing(SteamSettings settings, bool doNotDestroy = false)
A static method that can be used to create a Steamworks Behaviour safely on demand. It is not recommend to do this, you should be using a Bootstrap scene where the Steamworks Behaviour is set up at development time.
If you choose or simply must use a "late initialization" approach then this method can be used to safely create the Steamworks Behaviour and optionally mark it as Do Not Destroy. Note this will not create anything if a Steamworks Behaviour already exists.