Replication UMG


I created some kind of lobby for my game nothing fancy just so the players can select their characters before the game. Now my problem is the server gathers information from a database which characters can be played and updates a list on the each playerstate whith characters the player can use. The available characters are displayed in a widget. My question is what is the best way to get the data from the playerstate and show them in the widget. Currently I am just updating the widget in its Tick() function by calling the variable from the playerstate but that seems kinda hacky.

Set your variables to “Rep w/ Notify”.

After your widget’s been constructed, save it in your PlayerState (either from the UMG class itself or by using GetAllWidgetOfClass() in the PlayerState) and have an OnRep_YourVariable() function which calls the cached UMG and updates it.

Alternatively, you could try to make use of some delegates in your PlayerState which get called by the OnRep_YourVariable() function.