On a player death, I try to set the controller state to Spectating. I have made my own BP_SpectatorPawn Inherit from ASpectatorPawn and configure the game mode for use it.
In the player character death function, I call a controller function SetSpectatorState just after a DetachFromControllerPendingDestroy():
It work fine on the server player death. But the SpectatorPawn seams to be the default SpectatorPawn on the client and it's created at 0,0,0 instead of the current view location. The game state seams to replicate correctly the Reference to the SpectatorPawn class. I don't understand why the client have this comportment.
In the player character death function, I call a controller function SetSpectatorState just after a DetachFromControllerPendingDestroy():
Code:
void ASPlayerController::SetSpectatorState() { PlayerState->bIsSpectator = true; ChangeState(NAME_Spectating); ClientGotoState(NAME_Spectating); }
Comment