Transferring data between scenes in a multiplayer system.

Hello, I want to learn how data is transferred between scenes in a multiplayer system. For instance, when a player is in the menu scene, I would like to carry certain entered information (such as a nickname, selected weapons, or details determining how the character looks, etc.) to the main gameplay level and perform operations there. Is there anyone who can assist me with this topic? How is it done?

I’m putting these in GameInstance, because that persists for the life of the game across levels.

But they need to be replicated in other places. As I understand:

  • Character - resets on respawn
  • PlayerController - persists on respawn but local only
  • PlayerState - persists on respawn and replicates, meant to hold current info about players that everyone can access. So a name can go here.

I don’t think Selected Weapon or Appearance data is relevant to other players, and can be set when a character spawns.

Hey there, I tried using a game instance, but I wasn’t very successful. Here’s what I did: I created a variable called ‘nick’ in the game instance and set its value to ‘abc’ by accessing the game instance from the Player Controller. When I move to a new level, I access the value from the game instance through the ‘event on postlogin’ in the Game Mode section, and yes, I successfully retrieve the value ‘abc’ for the first player. However, even though the second player sets the game instance value to ‘bbb’ while in the menu, when I transition to a new level, it still displays the old value, which is ‘abc’. I couldn’t figure this out. Could you please assist?

You can add custom data as well.

For cosmetics you’d typically have these stored in a database backend in which the game server or Matchmaking would connect to and pull when a connection is created.

You could do this with GameUserSettings but it being stored on the client can never be fully trusted.