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 baed5da63a
commit 3d024ae1c7

View File

@@ -1,7 +1,7 @@
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "AutoLoginUserCallbackProxy.h"
#include "Kismet/GameplayStatics.h"
//////////////////////////////////////////////////////////////////////////
// ULoginUserCallbackProxy
@@ -44,6 +44,26 @@ void UAutoLoginUserCallbackProxy::OnCompleted(int32 LocalUserNum, bool bWasSucce
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)
{
OnSuccess.Broadcast();