Hello, i am making a LAN project that has a lot of widgets being created at runtime and added as children to parent widgets, i am trying to figure out how i can go about saving those widgets so when the game is loaded the widgets appear on the screen.
The way i am doing the communication between the client and the host now is i set the variables or on the client, pass that information to the Player Controller and then update the server variables. Saving widgets and replication has me a bit confused.
You can use save game to save the variables that will populate the widgets and set them on the game instance. If you need multiple players to see variables from a number of players that are replicated, you should probably pull those variables from the game instance off the save game and set them replicated on the player state.
You can pull those replicated variables off the player states to populate the widgets from a widget created in the game instance you can call from somewhere else. So for instance, you can create a widget and add a child to a box within the widget with a For Each Loop for each player by getting the Game State-> Player Array-> For Each Loop-> Cast to Your Player State-> Retrieve Variable → Populate your line of information with the variable and add child to the box variable in the widget. If that makes sense…
The player state will hold replicated variables visible to all other players within your game and you can readily get them from the player array off the game state. This isn’t quite as easy using the player controller exclusively and works a bit differently in that aspect.