Download

What's the best way to reference/spawn each player's choice of pawn in multiplayer?

I’m trying to setup vehicle selection in my current game. I’m saving the player’s choice of vehicle in the save game (via the game instance). In singleplayer, everything works fine. In multiplayer, I can’t seem to get a reference to the player’s vehicle choice no matter where I set it. I’ve tried setting it on in both the state & controller on begin play, I’ve tried setting it in the game instance itself and referencing that instead of the save, tried setting it at spawn time via client/server RPCs & replicated vars; nothing seems to work!

I understand replication basics, my multiplayer mode and replicated variables from player state for score etc. all work fine, but I can’t wrap my head around why this won’t work.

What is the proper way to check the client’s saved game for their preferred pawn/customization options and then spawn it on the server?

I think I’ve solved it, though I am not sure it’s the best way to go about it. My flow:

Player controller begin player → if local controller → cast to game instance, get save/var, set PC var with server RPC. Game mode spawn function → wait until PC var != none → spawn.

I guess it was a race condition like I initially thought last night. :man_facepalming: Does anyone know if there is any better way to handle this, or is the delay on spawn ‘sufficient’?

The spaghetti: