set cached unique net id in auto login as well

This commit is contained in:
Joshua
2022-08-30 08:42:18 -04:00
parent 3ac5d6c664
commit 7f1b47f42d

View File

@@ -1,7 +1,7 @@
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "AutoLoginUserCallbackProxy.h" #include "AutoLoginUserCallbackProxy.h"
#include "Kismet/GameplayStatics.h"
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// ULoginUserCallbackProxy // ULoginUserCallbackProxy
@@ -44,6 +44,26 @@ void UAutoLoginUserCallbackProxy::OnCompleted(int32 LocalUserNum, bool bWasSucce
Identity->ClearOnLoginCompleteDelegate_Handle(LocalUserNum, DelegateHandle); Identity->ClearOnLoginCompleteDelegate_Handle(LocalUserNum, DelegateHandle);
} }
if(APlayerController* PController = UGameplayStatics::GetPlayerController(WorldContextObject->GetWorld(), LocalUserNum))
{
ULocalPlayer* Player = Cast<ULocalPlayer>(PController->Player);
auto uniqueId = UserId.AsShared();
if (Player)
{
Player->SetCachedUniqueNetId(uniqueId);
}
if (APlayerState* State = PController->PlayerState)
{
// Update UniqueId. See also ShowLoginUICallbackProxy.cpp
State->SetUniqueId((const FUniqueNetIdPtr&)uniqueId);
}
}
if (bWasSuccessful) if (bWasSuccessful)
{ {
OnSuccess.Broadcast(); OnSuccess.Broadcast();