I am making a multiplayer game and i have the next problem. When I execute two instances, the server instance creates the pawn and I can control it, but when is the turn of the client, the server doesnt spawn a pawn and I cant play with the client, I only can use an spectator pawn in the client.
Anyone knows why I cant spawn and play with the client? I execute all in the editor on a new windows with two instances. I changed the Engine.ini for the multiplayer and all is on LAN.
Using “GetGameMode” client-side won’t work since GameMode only exist server-side so afaik SpawnPlayer would never be called from the Client to the Server.
You need to make a “RunOnServer” event in the PlayerController where you make the switch from client-side to server-side and then call the SpawnPlayer function in GameMode.
The ClientPostLogin event you have is set to “Executs on Owning Client” so from there on you know you are client-side. Make a new custom event that is “Run On Server” and call it here (client-side). Now you are server-side and can use GameMode to call your server functions.
With Run On Server you means in the Replicates field, dont you? And this new custom event I need to create on client-side in the player controller or in another place?