UMG button not allowing visibility change after made visibile

I ran into an annoying issue with a button in umg. I have a variable, when set to true, a button becomes visible. What is supposed to happen is, the button gets pressed, the variable that toggles its visibility is set to fals, and the button itself hides. However, once the button appears, it doesn’t how many times I press it, it won’t disappear. I also tried using a bind on the visibility and toggling it from outside of the widget. None of the above makes it work right. Has anyone else run into this?

Hello TrayJ.

Can you show the blueprints you use?


The top bp is where I set the check whether the boolean was true or not. The second one is what happens when the button is pressed. I originally had it resetting the variable, followed by rehiding the button, but this also wasn’t working. The button stays visible on all attempts after it is first triggered visible once.

This part looks fine. Can you put an print behind set visibitlity hidden to look if it is being executed? And if that is working then it goes wrong some where else I cannot really tell from only this small part of the code.

It returns as false, so it IS doing that right. These two sections I posted are the only things that deal with this button, though, so I’m kind of lost as to what is causing this.

What if you cast instead of using a variable, same behavior?

It should work to do it like this within the widget itself;

OnClicked -> Set Boolean to False -> Set Visibility to Hidden/Visible

Looked at the FlipFlop node?

I tried that first. Same result. Weird thing is, I tried duplicating the issue in a different project, and it worked right in there.

Ah, I’ve had some rather peculiar issues like that myself albeit on rare occasions. If you’re lucky you might just get away with making a new widget BP.

I tried the new widget as well. I first tried it with just two buttons that toggled each other’s visibility. Those worked properly. I then reproduced the original widget, only to get the same result as the previous widget. I had an idea, though to add a print string to the event tick to check always if the “retry” variable was set. It sets at the correct time (when the conditions are met), but when I hit the button to not only make the button disappear, but also toggle the “retry” variable off, the print string on the event tick states is it is still active. However, when I also attached a print string to the variable that is being set to off, it returns false. How is that possible? It says it is false, yet at the same time is reading it as true.

It sounds like the tick function or some other blueprint is setting it to true. Have you tried to make a new boolean variable and use that one? if so can make a screen shot of the whole blueprint?

That was the problem. I had forgotten to reset some of the variables that would cause the “check for retry” to tick on. So it was constantly staying in the “on” position. Thanks for the help.