State of player authority changes by itself

Hi,

I am trying to change the pawn of the players to the spectator pawn and set their state to spectator.
It works for all clients but for the server it doesn’t. The authority player cannot move because the pawn is always NULL in the C++ controller.
I used Showdebug INPUT to see what was wrong and this is what it showed me but since I it is the first time I use this command I don’t know what everything means.

At the right there is the server and the left the client.

As you can see the server is in state “playing” and the controller gets the inputs but the pawn is null even though the debug says otherwise.

If I wait a bit of time (like 30 sec) the server side update itself :

The state is suddenly Inactive and the pawn is not shown anymore :frowning:

This is the code I use to switch to spectator :

SetSpectator(true);
		APawn* lastPawn = GetPawn();
		this->ChangeState(NAME_Spectating);
		if (lastPawn != NULL)lastPawn->K2_DestroyActor();
		this->ClientGotoState(NAME_Spectating);

Here I call it :

What could be wrong ?

Okey I finally found the issue !
It was pretty simple : don’t use GetPawn(), use K2_GetPawn() (thanks to the doc :slight_smile: ). I also took away the PossessSpectator because it was redundant.

rXp