No Pawn when changing state to Spectating in Player Controller

When a PlayerController changes state to Spectating by calling ChangeState(NAME_Spectating) , there is never a pawn assigned for the controller, so the spectator cannot move around by GetPawn()->AddMovementInput() calls

When calling ChangeState(NAME_Spectating), tracing in the debugger reveals that BeginSpectatingState() is called which does spawn the spectator pawn, but never calls SetPawn().

A manual call to SetPossess(GetSpectatorPawn()) will eventually make it down to SetPawn(), but one of the last things OnPossess() does is Change State to Playing, which reverts the whole spectator process, eventually nullifying the pawn.

Should OnPossess() be smart enough to know that a spectator pawn is what is being possessed and not assume a Playing state?

It occurred to me that spectator mode only allowing camera rotation might be intentional engine behavior for Spectating state. It’s atypical for a game to allow camera movement for a pawn that recently died and might be entering spectator mode.

By explicitly calling SetPawn(GetSpectatorPawn()) I do get character movement through the spectating pawn. This works for now.

It still might be an engine bug that calling OnPossess() while spectating changes to the playing state; but I’ll leave that up to the UE programmers.