Page cover

C++

Like what you're seeing?

Introduction

Working in C++ then add this to your Build.cs

PrivateDependencyModuleNames.AddRange(
    new string[]
    {
        //... your other dependencies
        "Steamworks",
    });

//This is important to
AddEngineThirdPartyPrivateStaticDependencies(Target, "Steamworks");

now in code, you should be able to do this

THIRD_PARTY_INCLUDES_START
#include <steam/steam_api.h>        //For client APIs
#include <steam/steam_gameserver.h> //For server APIs
THIRD_PARTY_INCLUDES_END

Heathen's Steam Game Instance includes this for you and comes with a slew of helpful tools such as exposing all the callbacks to events and defining linker wrappers enabling a more modern callback structure than the native Steamworks SDK was set up for.

To access it in code, simply add it to your dependencies:

PrivateDependencyModuleNames.AddRange(
    new string[]
    {
        //... your other dependencies
        "ToolkitSteamworks",
    });

You should now be able to access SteamGameInstance and HeathenTools, its worth noting that Unreal Editor would do this for you. To do so, in the editor click Add C++ object and choose the parent class of SteamGameInstance. You'll often want to create a derived instance anyway especially when working in C++ as this acts as your most global instanced object initializing right after engine load.

Last updated