Hi, I'd need help with setting up a lobby widget, where the server has the option to change some settings and the client gets these changes on his screen as well (like server selects a different map, so client updates the "selected map" text field respectively). I managed to get the button visibility system working, so I can decide which buttons I hide for the client when the widget is spawned. My problem is displaying the server's version of a variable to the client. In this concrete case I am trying to show the name of the players in the lobby.

Here is how I approached it, and it is not working.
In myPlayerState, I created two replicated variables: 'Host Player Name' and 'Client Player Name'. Upon Event Begin Play, I set two timers to run a Custom Event each second, depending on the authority of the player. If he has authority, I execute a Multicast Event named 'Refreshing Host Name', and I set the 'Host Player Name' to the name of the player (from the built in 'Player Name' variable). If he is a client, I execute a Run On Server Event, and I set the 'Client Player Name' to the name of the player.

In myPlayerController (the 'Master Lobby Widget' is spawned from here) I run a function called 'Update Player Names' each second. In the function, I cast to myPlayerState and I update the host and a client name fields in the widget with the value of 'Host Player Name' and 'Client Player Name'.

The result is that the server only shows his own name, no matter if he is alone, or the client is connected, and the client shows his own name for both the host and client player name slots, which is quite confusing for me.
Any help regarding this would be really appreciated.
Thanks.
Here is how I approached it, and it is not working.
In myPlayerState, I created two replicated variables: 'Host Player Name' and 'Client Player Name'. Upon Event Begin Play, I set two timers to run a Custom Event each second, depending on the authority of the player. If he has authority, I execute a Multicast Event named 'Refreshing Host Name', and I set the 'Host Player Name' to the name of the player (from the built in 'Player Name' variable). If he is a client, I execute a Run On Server Event, and I set the 'Client Player Name' to the name of the player.
In myPlayerController (the 'Master Lobby Widget' is spawned from here) I run a function called 'Update Player Names' each second. In the function, I cast to myPlayerState and I update the host and a client name fields in the widget with the value of 'Host Player Name' and 'Client Player Name'.
The result is that the server only shows his own name, no matter if he is alone, or the client is connected, and the client shows his own name for both the host and client player name slots, which is quite confusing for me.
Any help regarding this would be really appreciated.
Thanks.
Comment