Spawning actors in online multiplayer?

Hello. I may be trying to do this all wrong, but I am trying to create an online multiplayer game where everyone in the online match shares a camera. I have made it so that my default pawn class is a camera that spawns in the same location, and has variables for another player controller that possess a character that spawns in a set location. I’m having trouble with the replication end of this because when the client user spawns, the server cannot see the spawned character. Currently I have Event Begin Play plugged into Switch Has Authority, and if it has authority, it spawns a controller and sets my controller variable, and then spawns a character and sets the character variable, and then the created controller possess the created character.

Any and all helpful feedback is very appreciated!

You need to wait until a player has connected before you can spawn the characters. In our project, we react to OnPostLogin in the GameMode.

If you define the character’s default controller in the character’s Class Defaults and mark it as “Spawned” or “Placed in World or Spawned”, you don’t need to create the controller manually. Instead the character will be auto-possessed by such a controller right after creation.

59664-autopossesscharacter.png

Thank you so much! I don’t know why I didn’t think to just look at how the Multiplayer Shootout example did this. I blame exhaustion. Thank you again!