Download

GameInstance Doesn't Save Variables Moving To New Level

Hi!
Quickly: at the end of the first level (multiplayer) the game instance has array variable Team1 with its players and Team2 with its ones. When I move from the lobby to another map, I make the server access to the game instance to say other players in which team they are.

Well, the array are empy. Or better, if i print theri length, I see the correct length. But when I print the name of members in a FOR LOOP, nothing appears.

So what could it be the reason?

I hope you have the answer

the GameInstance is not replicated (synced through network), so each player only has its own local copy and doesnt know anything about the others. you should store your team arrays in a GameSTATE, which IS replicated to everyone. that way all players will know who is in what team.

see docs for detailed explanations how different game classes work and connect between each other:
gameplay framework: Gameplay Framework Quick Reference | Unreal Engine Documentation
networking overview: Multiplayer in Blueprints | Unreal Engine Documentation
cedrics awesome networking compendium: http://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf

Thanks man, tomorrow I’ll try use gameState, I knew that game instance is only one for all players for all the game duration…
I’ll let you know