The Kongregate SDK now has basic Steam support for Unity and Air games. For Unity, the authetication and analytics APIs are supported. For Air, only authentication is supported.
In order to enable Steam support for Unity, you must set
true and build using Unity’s Standalone target. When running in the Unity Editor with the build target set to “PC, Mac & Linux Standalone”, the SDK will be enabled and generate real events from within the editor. This step is not required for Air.
The Kongregate SDK has a dependency on some native Steam SDK methods. In order to access that functionality, it makes use of a
SteamAdapter interface to allow flexibility with regard to the underlying Steam SDK wrapper of your choice.
UNITY: If you are using SteamWorks.NET and their
SteamManager wrapper, a
SteamworksAdapter.cs class is provided in the
Unity folder of the SDK ZIP. Including this file in your build will cause it to be used automatically. It is not provided in the
.unitypackage bundle since not all games support Steam or use SteamWorks.NET.
If you are using a different wrapper to access the Steam SDK, you will need to create an implementation of the
ISteamAdapter interface and set
KongregateAPI.Settings.SteamAdapterClass to that class. See the Unity API Documentation for more details on how to correctly implement the interface.
AIR: If you are using the FRESteamWorks Air Extension, a
FRESteamWorksAdapter.as implementation is provided in the Support folder of the SDK ZIP. You may set
KongregateAPI.settings.steamAdapter to an instance of this class to utilize the adapter. If you use another adapter, you will need to implement
ISteamAdapter and use it for this setting. Feel free to use
FRESteamWorksAdapter.as as a reference implementation. See the Air API Documentation for more details.
Opening the Kongregate Panel will allow Kongregate users to link a Kongregate account to their Steam account. Once the accounts are linked, you will receive the user’s Kongregate ID and game auth token as you would on any other platform, and can authenticate via our REST API.
The SDK automatically checks for linked accounts upon gaining focus, which ensures linked accounts will be detected once the user returns to the game.
Analytics functionality (via Kong Analytics) should work as normal when targeting Standalone/Steam builds. Be sure to set the Kong Analytics ID and Key up properly, and events should fire just as they do for mobile and web.
Since standalone builds do not provide a bundle ID or application version, you will need to manually set two additional fields in the
KongregateAPI.Settings object, as shown below:
KongregateAPI.Settings.BundleID = "com.kongregate.mobile.<gamename>.steam"; KongregateAPI.Settings.AppVersion = "<your_app_version_string>";
KongregateAPI.settings.bundleID = "com.kongregate.mobile.tpt.air"; KongregateAPI.settings.appVersion = "1.0.0";