Merge pull request #24 from lotodore/login_update_playerstate_uniqueid

Update PlayerState UniqueId after Login

Good pull request, accepted
This commit is contained in:
Joshua (MordenTral) Statzer
2022-03-07 08:22:33 -05:00
committed by Joshua
parent 9784cd2f01
commit 18475eb2ef

View File

@@ -64,6 +64,7 @@ void ULoginUserCallbackProxy::OnCompleted(int32 LocalUserNum, bool bWasSuccessfu
if (PlayerControllerWeakPtr.IsValid()) if (PlayerControllerWeakPtr.IsValid())
{ {
ULocalPlayer* Player = Cast<ULocalPlayer>(PlayerControllerWeakPtr->Player); ULocalPlayer* Player = Cast<ULocalPlayer>(PlayerControllerWeakPtr->Player);
auto uniqueId = UserId.AsShared();
if (Player) if (Player)
{ {
@@ -73,6 +74,15 @@ void ULoginUserCallbackProxy::OnCompleted(int32 LocalUserNum, bool bWasSuccessfu
{ {
Identity->ClearOnLoginCompleteDelegate_Handle(Player->GetControllerId(), DelegateHandle); Identity->ClearOnLoginCompleteDelegate_Handle(Player->GetControllerId(), DelegateHandle);
} }
Player->SetCachedUniqueNetId(uniqueId);
}
APlayerState* State = PlayerControllerWeakPtr->PlayerState;
if (State)
{
// Update UniqueId. See also ShowLoginUICallbackProxy.cpp
State->SetUniqueId((const FUniqueNetIdPtr&) uniqueId);
} }
} }