The behavior of the Player State being set to null on calling Unpossess()
on the controller is still present as of 5.3.2.
Namely, AController::UnPossess()
is calling OnUnPossess()
:
void AController::UnPossess()
{
APawn* CurrentPawn = GetPawn();
if (CurrentPawn == nullptr)
{
return;
}
OnUnPossess();
//...
AController::OnUnPossess()
is calling Pawn->UnPossessed()
, which is doing the setting of the player state to null:
void APawn::UnPossessed()
{
AController* const OldController = Controller;
ForceNetUpdate();
SetPlayerState(nullptr);
SetOwner(nullptr);
Controller = nullptr;
//...
Design-wise, why do calls to AController::UnPossess()
(and AController::Possess()
, in fact) modify the player state at all? Or is this really a long-existent bug?