Skip to main content

Accessing the EOS SDK directly

If you need to call EOS SDK functions that are not yet handled by the plugin, you can include the shared headers and call the EOS SDK directly.

info

This functionality is not available in the Free Edition, as the Free Edition does not include source code. If you need to call the EOS SDK directly, you'll need to be using the Marketplace Edition.

Reference the OnlineSubsystemRedpointEOS and RedpointEOSSDK modules

To access the headers of the plugin directly, you'll need to add a dependency on the "OnlineSubsystemRedpointEOS" and "RedpointEOSSDK" modules to your .Build.cs file:

PublicDependencyModuleNames.AddRange(new string[]
{
"OnlineSubsystemRedpointEOS",
"RedpointEOSSDK"
});

// This adds the required e.g. UE_5_1_OR_LATER defines for shared plugin headers to work.
OnlineSubsystemRedpointEOS.ApplyEngineVersionDefinesToModule(this);

Reference the shared headers

To get a direct reference to the EOS SDK, you need to include the plugin headers:

#include "OnlineSubsystemRedpointEOS/Shared/EOSCommon.h"
#include "OnlineSubsystemRedpointEOS/Shared/OnlineSubsystemRedpointEOS.h"
caution

Although the specific API call we're about to make is unlikely to change, you should be aware that the headers under Shared/ are not stable and can change between plugin releases. The more plugin internals you reference, the more likely you'll have to update your code when upgrading the plugin.

Obtain and cast the online subsystem, then access the EOS SDK

To access the EOS SDK, you need to get the platform handle via the current online subsystem:

IOnlineSubsystem* OSS = Online::GetSubsystem(this->GetWorld(), FName(TEXT("RedpointEOS")));
if (OSS != nullptr)
{
// Do not store this pointer beyond the function scope! You must
// call Online::GetSubsystem again any time you want to access
// the online subsystem or the EOS SDK, since the lifetime of these
// pointers is controlled by the engine.
FOnlineSubsystemEOS* RedpointEOSOSS = (FOnlineSubsystemEOS*)OSS;

// Do not store this variable beyond the function scope! See above.
EOS_HPlatform Platform = RedpointEOSOSS->GetPlatformInstance();
if (Platform != nullptr)
{
// Call the EOS SDK directly using the platform handle.
}
}