From 31c4be3629f64117a4e1df6455a8864f7cc0b7a3 Mon Sep 17 00:00:00 2001 From: Lothar May Date: Sun, 12 Dec 2021 17:25:56 +0100 Subject: [PATCH] Update UniqueId in login callback. See also ShowLoginUICallbackProxy.cpp in UE sources. (cherry picked from commit 826bef7b861e8c20013033b57dd45cd8fec304e5) --- .../Private/LoginUserCallbackProxy.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/LoginUserCallbackProxy.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/LoginUserCallbackProxy.cpp index 3c9fb54..b2c6b5a 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/LoginUserCallbackProxy.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/LoginUserCallbackProxy.cpp @@ -64,6 +64,7 @@ void ULoginUserCallbackProxy::OnCompleted(int32 LocalUserNum, bool bWasSuccessfu if (PlayerControllerWeakPtr.IsValid()) { ULocalPlayer* Player = Cast(PlayerControllerWeakPtr->Player); + auto uniqueId = UserId.AsShared(); if (Player) { @@ -73,6 +74,15 @@ void ULoginUserCallbackProxy::OnCompleted(int32 LocalUserNum, bool bWasSuccessfu { Identity->ClearOnLoginCompleteDelegate_Handle(Player->GetControllerId(), DelegateHandle); } + Player->SetCachedUniqueNetId(uniqueId); + } + + APlayerState* State = PlayerControllerWeakPtr->PlayerState; + + if (State) + { + // Update UniqueId. See also ShowLoginUICallbackProxy.cpp + State->SetUniqueId(uniqueId); } }