The Heathen Steam API wrapper
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!
The Heathen API provides access to the full Steam API wrapping every interface with a Unity friendly static class, simplifying use of the raw API without reducing its functionality and exposing every callback as a UnityEvent and every callresult as a Unity firendly Action.
We have wrapped every interface (except Networking interfaces) and copied its relevant documentation meaning you can now explore Valve's own documentation in your IDE via IntelliSense, take full advantage of auto complete and suggestions and explore the full API via the object explorer.
Why not wrap the networking interfaces?
We feel networking is best served working directly against the API with no "middle layer" sitting between. We are happy to revisit this if there is a community demand for it.
We are still built on top of Steamworks.NET something we feel strongly about as it provides an unadulterated view of the Steam API making it possible for you to leverage decades of community guides, sample code, the official Steam Developer forums and support channels from Valve, etc.
Heathen's API does wrap the raw Steam API up as an extension to Steamworks.NET making it not just C# friendly but more Unity native. You could say what Facepunch does for a C# programmer Heathen does for a Unity programmer, Unity designer, C# programmer, C/C++ programmer, etc. but we do a lot more on top of that with our components and objects built on top of this layer.
Every interface has been organized into subsclasses (.Client and .Server) making it clear what is available to the client, to a server or both. This works with conditional compile optionally stripping away code that is not available to the current build platform.
//Clearly client only
//Clearly server only
Valve's Steam API is big, powerful and written in C and C++ ... not exactly friendly to many of the tried and true patterns and structures we use in C#. Heathen's API still exposes the traditional methods but also provides C# based alternatives.
var count = API.StatsAndAchievements.Client.GetNumAchievements();
var results = new string[count];
for (int i = 0; i < count; i++)
results[i] = API.StatsAndAchievements.Client.GetAchievementName(i);
var results = API.StatsAndAchievements.Client.GetAchievementNames();
Steam API makes heavy use of callbacks and callresults which is Valve's answer to delegates. In Unity we normally use UnityEvents (for callbacks) and Actions (for callresults). Heathen's API wraps every occasion of callback and callresult with the appropriate Unity native equivalent managing the memory for you.
RAW STEAM API
if (m_NumberOfCurrentPlayers_t == null)
m_NumberOfCurrentPlayers_t = CallResult<NumberOfCurrentPlayers_t>.Create();
var handle = SteamUserStats.GetNumberOfCurrentPlayers();
m_NumberOfCurrentPlayers_t.Set(handle, (result, IOFailure) =>
//Do work here
API.StatsAndAchievements.GetNumberOfCurrentPlayers((result, IOFailure) =>
//Do work here