Unreal engine 4 Select Player Class Multiplayer Question

Before question, i have one thing to say.
I’m korean, so i’m not good at english. please understand…
And I’m not good at coding in Unreal Engine. Back to the point,
I’m creating Select Player Class System.
But, there is some problem.
When I start as a server, the player class I select is applied well, but when I start as a client, my selection is ignored and the server’s selection is followed. I wondered if the selected player class of the game instance was strange, so I printed it out as a print string and it came out fine. Why is this problem happening?
FPSGameInstance





1 Like

The GameMode only exists on the server. Therefore, the PostLogin event is only called on the server. When you are getting the GameInstance inside of the PostLogin Event you are retrieving the servers GameInstance which contains the servers selection. What you have to do is to replicate the clients selection to the server and then use this replicated value to spawn the player character. I also recommend using the PlayerState class for saving the character class instead of the GameInstance as the GameInstance is not replicated.

1 Like