ServerTravel - PlayerController Problem


Im having a problem with ServerTravel, im working in a lobby players connect it with a openlevel, everthing is fine until here.

1 . Then when the players are connected to the lobby i call from the server ServerTravel() function.
2 . I made an override to GetSeamlessTravelActorList(bool bToEntry,TArray< class AActor* >& ActorList) in the player controller and add the player controller to the ActorList.
3 . In the gamemode i made an override PostSeamlessTravel(), get the playercontroller with:

TArray<AActor*> playerControllers;
UGameplayStatics::GetAllActorsOfClass(this,APlayerController::StaticClass(), playerControllers);

4 . in the PostSeamlessTravel() also spawn a Pawn, posses the new Pawn and set the input mode to game.

The server has: 2 PlayerController (Server PC and Client PC)
The Client has: 1 PlayerControler (His own PC)

After this server player can move without a problem, but client player can not move.

Any idea why it can happen? The only thing that comes to my mind is that the PlayerController that is on the server is not the same as the client has.

Hi @Jmgc92 ,

**Server don’t create its own player controller. Whatever PC you will have will be of clients. **Player controller gets registered into Server and its list can be retrieved from Game State class. Please know that if you are using listen server, your server by default will have a client on which its hosted, so it will count the player controller that way as well.

Whatever function you want to execute on the client, you need to send it to server to execute it and then it will be replicated to the clients. So make sure whenever you are ordering something on the client, that call actually route to server and then its executed

Thank @Fieol , your reply made me see it clearer.

I use a server function to call a TimerHandle with a 0.2 delay seconds, for some reason the playercontroller that i was getting in PostSeamlessTravel() was not the same as my clients have.

So after add that delay to get all the playercontroller again, i get the same player controller that my clients were owning, so i can posses successfully the pawn now and move.


Hurray! :cool: