Pawn PlayerState reference on client is sometimes NULL

Confirm . So do i .

Confirmed, being in 4.21.0. Pretty reproducable, using PlayerState right in OnRep_PlayerState() itself. So I decided to handle every PlayerState-related thing on Server from there on, which works and throwing a log there to remind me that “sometimes” PlayerState is invalid on Client.

Been having this issue since forever. Glad to see some input on it, but I’m not using a spectator class. One other thing I noticed is that invalid client won’t use Player Spawn points. Instead, they just float at 0,0,0 where I’ve built a holding chamber for me to recognize problem when bug-testing as a user.

Confirmed In 4.27

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?

confirmed on 4.27
on client local PlayerControler is there (for Player2), gamestate has one element in PlayerArray (which is PlayerState for Player1), and PlayerState for Player2 is null and its not present in PlayerArray

What fixed it for me was that I forgot to call
Super::UnPossessed();
in my custom Pawn class when I override UnPossessed()

Or not, maybe it was just a lucky run, now again this happened