Download

Where are the Online Subsystems names defined?

I’m trying to extend the Facebook Online Subsystem and so far I’ve been able to create my own plugin with a copy of the current Facebook OSS as my subsystem, and I’ve implemented a simple status update.

But I’m not sure how exactly I set to use it.

In a component that I was first using to expose Facebook functionality to Blueprints I was getting the original subsystem with:


IOnlineSubsystem::Get(TEXT("Facebook"));

Now, I’d like to change “Facebook” to my subsystem, but I’m not sure how.

Where was the Facebook Online Subsystem name defined as “Facebook”? Doesn’t seem to be defined inside OnlineSubsystemFacebook.Build.cs.

The same could be asked for the Steam Online Subsystem, when we use:


IOnlineSubsystem::Get(FName("Steam"));

When was the name “Steam” defined for the Steam OSS?

It seems like that in order to use my subsystem I need to give it a name, but the question is: where?

Or maybe there’s another way?

Thanks!

Looks like I got it.

Every subsystem name is defined inside OnlineSubsystemNames.h and are used inside the Module StartupModule() inside RegisterPlatformService. Here’s how it looks for Facebook:

OnlineSubsystemNames.h:


#ifndef FACEBOOK_SUBSYSTEM
#define FACEBOOK_SUBSYSTEM FName(TEXT("FACEBOOK"))
#endif

OnlineSubsystemFacebookModule.cpp:


void FOnlineSubsystemFacebookModule::StartupModule()
{
	UE_LOG(LogOnline, Log, TEXT("Facebook Startup!"));

	FacebookFactory = new FOnlineFactoryFacebook();

	// Create and register our singleton factory with the main online subsystem for easy access
	FOnlineSubsystemModule& OSS = FModuleManager::GetModuleChecked<FOnlineSubsystemModule>("OnlineSubsystem");
	OSS.RegisterPlatformService(**FACEBOOK_SUBSYSTEM**, FacebookFactory);
}

So I defined my own subsystem a name inside RegisterPlatformService at the startup of my module and it seems to be working.

Thanks :wink: