Hey everyone! I’m new to networking as a whole and have come upon an issue I can’t seem to solve, so any help would be appreciated.
Each PlayerState contains a current_team variable, an array of CharacterStructs (a party system, really). When the game begins, the GameMode tells the GameState to gather all of the CharacterStructs from both players’ current_team array. This collection is done server-side, collecting the current_team arrays and loading them into one of its own variables, either “_team1” or “_team2”. Then using a multicast event I spawn those characters out into the world on their respective start positions.
Get All Characters:
Here is where something gets messed up though. The SpawnCharacters function spawns a custom PlayerPawn_BP instance, basically a blank slate. I load this blank slate with all of the information held in the _team1 or _team2 variable (each are an array of 3 indices, each index a CharacterStruct. The CharacterStructs hold the skeletal mesh to spawn, the pawn’s name, heath, etc.) If I play with a listen server, the character’s spawn correctly, but only for the listen server’s PlayerState. For all clients, all pawns spawn, but they are still blank slates, having none of the _team1/_team2 data loaded into them. This makes me think that when the _team1/_team2 variables are written and the clients draw from those variables to spawn their pawns, they can’t access the correct data. However, both _team1 and _team2 are already set to replicate.
Any help would be greatly appreciated, thanks!