When my game starts I open a widget with buttons for types of characters. What I want to do is press a character button which spawns a pawn of that character in the level. However, I read that I shouldn’t do spawning logic (and in the future possessing) in the widget. So I created an event in the Game Mode which will spawn a character in the world, however, I want this to work with multiplayer and I read that clients can’t access the game mode.
How do I get around this problem? Is there somewhere else I should be doing the spawning logic?
Yes Widgets can’t be replicated and the GameMode only exist on the server so you need another replicated Actor to execute a RunOnServer Event.
The PlayerController or a Possessed Pawn can be used for this or any other replicated actor spawned by the server owned by the client PlayerController.
When the button is pressed you use the PlayerController/Pawn/ClientOwnedReplicatedActor to execute the event on the server and that should be it.