Download

BUG: SetVisibility behavior inconsistent between Single Player and Online

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:

  1. Create a new project - the FPS project template will do for expediency’s sake

  2. Create a new HUD widget and create and place two buttons on the widget screen

  3. 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)
    877ecb7ba965151340155e58cc7089fada156f5c.jpeg

  4. 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
    289a946bf9b792d49e875cc05a31948d6a3ae45f.jpeg

  5. 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.

  6. 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.