I’ve encountered a bug trying to use the Set Visibility function on HUD widget elements. In single player, SetVisibility triggered by a custom event is able to change the visibility of an element from Visible to Hidden and back without issue. When playing with two or more players, on or off of a dedicated server, SetVisibility triggered by a custom event often fails to change the state of a HUD element.
Replicating this is simple enough:
-
Create a new project - the FPS project template will do for expediency’s sake
-
Create a new HUD widget and create and place two buttons on the widget screen
-
Set up two custom events to toggle the visibility of the buttons on the screen (I have attached an image below to serve as an example)
-
In the Default Pawn blueprint EventGraph (FirstPersonCharacter in the FPS template) create a variable to store your new HUD widget and create it, store it and add it to the Viewport on EventBeginPlay
-
Lastly add in a new input event or use an existing one (such as the InputAction Fire for the FPS template) and use it to fire both your custom events in your HUD object - one on Pressed and one on Release.
-
When playing with just one player, you’ll find toggling your input will make the visibility of your buttons toggle back and forth. If you add a second player, however, the SetVisible property will not function as expected. Generally, it doesn’t do anything. I added a print screen specifically to make sure the events were firing successfully on the appropriate client and found that they work fine - but the visibility of the elements does not change.
Is there something I’m doing wrong? Please advise.