Set Visibility of UMG (HUD) Widget in another Blueprint?

My game is a 2D Side Scroller for Mobile.

My HUD contains the Player Controls, Main Menu, Pause Menu and Level Failed Dialog.

I am trying to make it so that when the Character Hits or Collides with an object, the HUD displays the Level Failed Dialog, but when the Character does Hit the object, the Player Controls stay on the Screen as well as the Level Failed Dialog.
How do I get the Player Controls to disappear or Set Visibility to Hidden from another Blueprint?
Do I Cast? or Set a Boolean?

Blueprints Below:

You can call Remove All Widgets then add the widget you want.


You can do it in two ways. I’ll show you one way, but will tell you what the other is.

In my example, I’m setting visibility of a text box on hit event. If you want to set the visibility of a button, the method is the same.

Go to your character BP, create an enum visibility variable (I named it ‘Visibility’) and follow my graph;


Check the objects you are hitting by a simple class equal node.

Got to your widget BP and select your component that you want to set its visibility. Under the Behavior tab, bind the visibility to a function then open up the function and follow my graph;

You are done.

The other approach is to instead of binding visibility, try to set it from your character BP by a simple cast to. Note that in order to cast to a widget, first you should have created that widget inside a HUD and promoted it to a varibale, otherwise you can’t access your widget components.


Thank you!
With the first way, how would I make a widget hidden also?


Set the variable to ‘Hidden’ or ‘Collapsed’. You can use a delay node after setting it to visible to set it back to collapsed or use an event to do that. It’s up to you and depends on your game logic.

So if i want to make one Hidden and another Visible, I will create 2 Variable? One for each?

Typically you should refer one variable to one widget component. If you have different widget components with different visibility settings, then yes you should assign a variable to each of them. But if different components have same visibility settings, then you don’t need more than one variable for them. You also need to bind each widget component visibility to a new function if you want to assign a different variable to them.

Ok, thank you! I will try it in my project and see if it works.

I’ve tried it in my example and it worked. Should work for you too.


How do I bind the Visibility Enum to a Function? Thanks.

Thanks for the answer, could you please be more detailed?
Perhaps step by step.


I managed to resolve it using parts of your answer!

Thanks you!