GameObject Initialization
Like what your seeing?
Support us as a GitHub Sponsor and get instant access to all our assets, exclusive tools and assets, escalated support and issue tracking and our gratitude. These articles are made possible by our GitHub Sponsors ... become a sponsor today!
Introduction
Initialize Steam API with a simple component script attached to a GameObject of your choice. You can use the Steamworks Behaviour or the Steamworks Creator to handle initialization for you. In both cases however you do need to first create and configure a Steam Settings object. Once you have your Steam Settings object defined and configured you can apply it to the Steamworks Behaviour or Steamworks Creator depending on which you choose to use.
Steamworks Behaviour
Learn more about the Steamworks Behaviour here.
Steamworks Behaviour is used to initialize a Steam Settings object on startup of the game and provides access to a few system level events such as Initialized.
You should only ever have 1 Steamworks Behaviour in your game.
You should NOT define your Steamworks Behaviour in your "main menu" or "title" scene as these scenes get loaded and reloaded multiple times. Instead you should use a "bootstrap" scene and place the behaviour and all other system level objects there. If you cannot or do not want to use a bootstrap setup then see the Steamworks Creator.
Steamworks Creator
Learn more about the Steamworks Creator here.
This is a simple script behaviour that checks if the Steam API is already initialized or not. If it is not it will create a new Steamworks Behaviour and optionally mark it as Do Not Destroy On Load.
This behaviour is here to help developers that are using the old approach to scene architecture and are not using a bootstrap process. You can safely put the Steamworks Creator in every scene of your game as it will only work if its required to do so.
This is not an efficient or robust way of architecting a game. We only support it as it is very common with new Unity developers. We very strongly encourage you to create a bootstrap process for your game in which case the proper place for Steam initialization is as part of that bootstrap process.
Steam Settings
Learn more about the Steam Settings object here.
Create a new Steam Settings object in your project folder by right clicking in your project tab and selecting Create > Steamworks > Settings
The only value you "must" set is the Application Id
Application Id
Enter your app ID in the Application Id field. If you don't have an application ID just yet that's fine you can work with the test App ID 480 however there will be some limitations.
Artifacts
The Steam Settings object can be used to reference all of your Steam "artifacts" such as Input Fields, Stats, Leaderboards, Achievements, DLC and Inventory items. For many of these artifact types you can define them in the Steam Developer Portal as you normally would and then use the "Import" button to pull them into your project.
Steam Game Server Configuration
The Steam Game Server Configuration lets you configure the details of your game server as it will be seen by Steam. This is only relevant for server builds that will be initializing and logging on as a "Steam Game Server"
This is most commonly done when you want to prevent the server from registering itself on the Steam Game Server browser until after you have made it ready such as after you have "StartServer" called on your HLAPI of choice and have configured the server making it ready for connections.
Last updated