Toggle visibility between two UMG images with one key

I’m currently trying to toggle visibility between two images that are in my main HUD. They’re held within their own separate vertical boxes, named gOd Drill Box, and gOd Gun Box respectively. (gOd = gun OR drill)

On the Widget-side, both boxes are set to hidden, while their children images are set to visible.

The highlighted area in the image below is the current (non-functioning) setup I have.

I think it’s important to point out that both the InputAction Swap and the Q Input below it share Q as a keybinding.

InputAction Swap sets up the condition for the Branch to the right of it, where my left mouse button plays one of my drill melee animations on True, or my gunfire animation on False. These are working very well, so I tried to follow the same logic in setting the visibility for the image display on my HUD.

I’ll include both of the Widget images to give as clear a picture as I can:

Main Drill:


Main Gun:


Thank you!

Hi Lauterdale,
I think what u are looking for is the FlipFlop-node. It toggles between two execution wires. So when u click Q once, u set the visibility of one image to visible and directly after that the other one to hidden. Other way around for the second execution pin.

Hi Lauterdale,
on your picture, u set GodDrill or GodGun, but there is no pin going into the visibility-nodes. So nothing happens. I would just use the SetVisibility-nodes like in ur first picture. Get the Widget, then get the Box and then Setvisibility.
Look at my picture:
When i click the left mouse button it sets use drill to true and when i release it to false. Then one Widget-Box gets Hidden and the other Visible.
That should work.

PS U could remove the pin coming from OnRelease, than u have to click twice to use the drill and then the gun.

yeah probably the reference to ur widget is not working correctly. in whatever Blueprint u put this nodes, u have to have a reference of the widget in which u want to set the visibility. When u use it in ur controller, go to begin play and get a refrence from ur widget.I think u did it right in ur first picture. mine is looking a bit different, cause i just created it fast to show u.

I know its hard to get started, but i would recommend u to go and look at some Tutorials. Look how they did it here for example:

u are welcome

Bump, hoping for some kind of hint.

Hey, man! Thanks for the response. Sorry on getting back to you so late. I tried (I think) what you’ve suggested, but still no luck.

I also tried setting the drill widget to visible and the gun to hidden, and visa versa.

I tried consolidating Input Swap and Q, as it seemed like they may have been cancelling each other out.

Ahh, I understand. I have it set up like your example, but I’m getting errors.

Any idea why that would be?
It looks like it could be that it’s not getting the full path to the gOd Drill and Gun

Alright, thanks for the help! If I have the right setup now, I’ll get started on looking through those tutorials. If I figure it out, I’ll post it as a comment. Until then, you definitely answered my questions. :slight_smile:

So bad… Why you dont get a reference from your “HandObject_ref” and then just set the HandObject to Drill_ref or Gun_ref. So you would create a ref that he holds something in his hand and then you bind 1 2 3 4 5 etc to the ref so 1 = drill_ref, 2 = gun_ref, 3 = sword_ref and then just set the HandObject_ref to the weapon you want and done… you could make it inside a function to make it more effective.