There might be a reason why this only works in standalone, but maybe there’s a workaround?
I run this code to log in to the Epic Online Services, using the Epic Online Services Online Subsystem Plugin:
void UMyGISubsystem::Initialize(FSubsystemCollectionBase& Collection)
{
Super::Initialize(Collection);
const IOnlineIdentityPtr OSSIdentity = Online::GetIdentityInterfaceChecked(FName(TEXT("EOS")));
// login handler
if(OSSIdentity->OnLoginCompleteDelegates->IsBound())
{
UE_LOG(LogNet, Warning, TEXT("%s: OnLoginCompleteDelegates: was bound, clearing"), *GetFullName())
OSSIdentity->OnLoginCompleteDelegates->Clear();
}
OSSIdentity->OnLoginCompleteDelegates->AddLambda([this] (int32 LocalUserNum, bool bSuccess, const FUniqueNetId& NewUNI, const FString& Error)
{
UE_LOG
( LogNet
, Display
, TEXT("%s: Login of player num %d: %s")
, *GetFullName()
, LocalUserNum
, bSuccess ? TEXT("success") : TEXT("failure")
)
UMyLocalPlayer* LocalPlayer = Cast<UMyLocalPlayer>(GetGameInstance()->GetLocalPlayerByIndex(LocalUserNum));
AMyHUDMenu* HUDMenu = LocalPlayer->GetPlayerController(GetWorld())->GetHUD<AMyHUDMenu>();
if(bSuccess)
{
LocalPlayer->IsLoggedIn = true;
LocalPlayer->SetCachedUniqueNetId(FUniqueNetIdRepl(NewUNI));
Cast<UMyGameInstance>(GetGameInstance())->SessionConfig.bEnableLAN = false;
HUDMenu->MenuMultiplayerShow();
}
else
{
HUDMenu->MessageShow
( FText::FromString(Error)
, [HUDMenu] () { HUDMenu->MenuMainShow(); }
);
}
});
// ...
}
When I run as standalone game, that works fine. I log in using DevAuthTool (but using the epic games website works fine, too), the callback gets executed a couple of seconds later.
When I run Play-in-Editor, I see the log output of some successful log-in, but the the callback never gets executed and thus my log-in status never gets updated.