Hey there,
So I’ve been working on a project based off of a large portion of the shooter game project code (I started a separate project and merged in what I needed) and I’ve got an issue with initialising the GameKing. Everytime I’m launching from Visual studio a break point triggers at “const auto IdentityInterface = OnlineSub->GetIdentityInterface();” Indicating that OnlineSub is null. I’ve added a small code segment below.
void UValkyrieGameKing::InitInternal()
{
// game requires the ability to ID users.
const auto OnlineSub = IOnlineSubsystem::Get();
check(OnlineSub);
const auto IdentityInterface = OnlineSub->GetIdentityInterface();
check(IdentityInterface.IsValid());
// bind any OSS delegates the King needs to handle
OnLoginChangedDelegate.BindUObject(this, &UValkyrieGameKing::HandleUserLoginChanged);
IdentityInterface->AddOnLoginChangedDelegate(OnLoginChangedDelegate);
FCoreDelegates::ApplicationWillDeactivateDelegate.Add(FCoreDelegates::FApplicationLifetimeDelegate::FDelegate::CreateUObject(this, &UValkyrieGameKing::HandleWillDeactivate));
FCoreDelegates::OnSafeFrameChangedEvent.Add(FCoreDelegates::FOnSafeFrameChangedEvent::FDelegate::CreateUObject(this, &UValkyrieGameKing::HandleSafeFrameChanged));
}
Now I’ve also added the module dependencies in my build script like so:
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "OnlineSubsystem", "OnlineSubsystemUtils", "AssetRegistry" });
PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore", "InputCore" });
if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Linux) || (Target.Platform == UnrealTargetPlatform.Mac))
{
if (UEBuildConfiguration.bCompileSteamOSS == true)
{
DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam");
}
DynamicallyLoadedModuleNames.Add("OnlineSubsystemNull");
}
else if (Target.Platform == UnrealTargetPlatform.PS4)
{
DynamicallyLoadedModuleNames.Add("OnlineSubsystemPS4");
}
else if (Target.Platform == UnrealTargetPlatform.XboxOne)
{
DynamicallyLoadedModuleNames.Add("OnlineSubsystemLive");
}
So I’m pretty stumped. Maybe there is something I need to change in the ini files? Any help would be greatly appreciated.