Download

Use Steam functions which are not in the OnlineSubsystem wrapper

Hey guys,
I am tinkering around with Steam, and I like those OnlineSubsystem wrappers, because it’s handy and they even work when Steam is not activated because it uses OnlineSubsystemNull then. So it has actually many interfaces to interact with Steam, like open windows in the overlay, or get the nickname and a picture of the user, but there are still features from Steam which are not implemented in the OnlineSubsystem wrappers (for example Steam Workshop integration (SteamUGC) or set the overlay notification position (SteamUtils)).
I include the following:



    #include "Runtime/Online/OnlineSubsystem/Public/Online.h"
    #include "Runtime/Online/OnlineSubsystem/Public/OnlineSubsystem.h"
    #include "Runtime/Online/OnlineSubsystemUtils/Public/OnlineSubsystemUtils.h"


And a piece of example code for the usage of my custom Game Instance I made to use simple Steam functions.


    void USteamGameInstance::Init()
    {
        IOnlineSubsystem* ion = IOnlineSubsystem::Get();
        FString nickname = ion->GetIdentityInterface()->GetPlayerNickname(0); //Just a test
        
        UGameInstance::Init();
    }


So, as a example I want to use the SteamUtils()->SetOverlayNotificationPosition(); function in order to set the position of those toasts. SteamAPI docs say:



SteamUtils()->SetOverlayNotificationPosition(k_EPositionTopLeft);


Visual Studio does not report any error, if I include ThirdParty/Steamworks/Steamv132/sdk/public/steam/steam_api.h, but I get a compile error:



    CompilerResultsLog:Error: Error SteamGameInstance.cpp.obj : error LNK2019: unresolved external symbol __imp_SteamUtils referenced in function "public: virtual void __cdecl USteamGameInstance::Init(void)" (?Init@USteamGameInstance@@UEAAXXZ)
    CompilerResultsLog:Error: Error C:\Users\Johnny\Documents\Unreal Projects\Steam\Binaries\Win64\UE4Editor-Steam-6665.dll : fatal error LNK1120: 1 unresolved externals


Does anybody have an idea how I can use the original Steam functions? Do I need to wrap them somehow in order to use them? I want this Workshop (UGC) feature, and I’m not sure if the wrappers already have that implemented, I think not.
Thanks for help :slight_smile:

I am not sure as I am new to this things in unreal but maybe you are not linking the steam_api.lib file.

I already fixed it by adding Steamworks to the public dependency modules inside the MyGame.Build.cs