[UMG] Calling SetVisibility on Widget is stopping Gamepad from "Clicking" the Widgets

Hey,

So I’m not sure whether this is intended functionality or not, so I’m posting here as I can’t find anything else online about it.

I have some custom widgets that only contain:

  • Size Box
  • Button (Size Box is Parent)
  • Image (Button is Parent)

These widgets are spawned into a Wrap Box at runtime in a larger UI Blueprint.

What I am trying to do is to make it so that, when one of the buttons is pressed, it can no longer be pressed until it is unselected (pressing B will go back through the chain of presses unselecting them one by one). This is kind of working, with the mouse, where, when one is selected, I set the Widget Visibility to HitTestInvisible and the mouse can no longer press it.

The current problem I am having is that as soon as I put in the line of code:

Widget->SetVisibility(ESlateVisibility::HitTestInvisible); // The visibility mode is irrelevant

the button stops responding to the Controller A Button. It doesn’t even matter what the Visibility mode is. Even if I set it to Visible, the controller still doesn’t “click” the button.

Is this a bug? Or am I doing something wrong?

The SetVisibility line is being called on the Parent UI Blueprint code which is spawning the custom widgets.

It is in NativeTick for now (just while I try to make it work), and I am iterating over the Wrap Boxes children and doing a check against the Array of selected objects with the buttons.

If the Array contains the selected object, then it is calling SetVisibility.

I’m not sure I explained the issue as well as I should have in the main post. The button itself if clicked with the mouse will be set to the visibility mode, so if I call Hidden, the button will hide when clicked with the mouse. The problem is that every button, when using the controller, cannot be clicked with the A Button, not just a specific button.

Hey Sospitas-

Where are you adding the SetVisiblity line? I created a UMG and set it up with a button like you described however I’m not sure how you’ve implemented the code. Please let me know what code is used so that I can attempt to reproduce this behavior on my machine.

Cheers

I’m still not sure I fully understand. When you click one button, you no longer can click the other buttons, is that what you’re saying? Can you provide a sample project that shows this issue or list the steps you used in your setup for me to follow in setting up my own investigation?

Hi, sorry.

Just spent a while trying to recreate it after getting home from work but I can’t remember some parts of how I did it originally. I’ll create a cut down version when I get to work in the morning if you still need it.

I’ll also just try to explain the problem as simply as possible now:

With Mouse:

  1. On level load, the UI is created, also creating a set of child Widgets within a Wrap Box within itself, and shown on screen.
  2. A widget is clicked, causing it to no longer be clickable until it is unselected.
  3. All other widgets are working fine, and can be clicked, becoming unclickable until unselected.

With Controller:

  1. On level load, the UI is created, also creating a set of child Widgets within a Wrap Box within itself, and shown on screen.
  2. Press R2 to focus first child widget. (Just focus the widgets somehow).
  3. Pressing A on any focused widget will not cause the widgets button to be clicked.

Sorry, it’s kind of awkward to explain.

I have a minimal project which has the same error ready now. How should I send it?

You should be able to zip the sample project and attach it here. If it is too large you can remove the Saved, Intermediate, and Content folders (unless there is content specific to the issue) before zipping to reduce the size of the project. If it is still too large you can upload the project to google drive or dropbox and post the download link here or send me a PM on the forums with the download link for privacy.

link text

Here it is.

I’ve also verified that the same behaviour happens when not using Tick in my main project. If I set it so that on a button press, it iterates over the buttons setting visibility, the same thing happens and the buttons no longer accept the A Button press.

EDIT: Forgot to add. If you press R2 while playing, then the focus will be set to the first widget allowing you to move around on the widgets.

I tested the project you provided and want to confirm what I’m seeing when I play:

With mouse:
Mousing over each individual check mark causes the box around it to highlight. Then when I press the left mouse button the check mark turns from light blue to dark blue. Clicking it again does nothing but clicking a different check mark makes the first return to light blue and the second turns dark blue.

With Controller:
Pressing R2 (RT actually b/c I’m using an XBox controller) causes the first check mark to turn dark blue (as if clicked by the mouse). Pressing right on the D-pad or analog stick causes a selection box to appear around the second check mark box as well as turn the second check mark dark blue (as if clicked). Continuing to move the selection box with D-pad/analog stick will turn the associated check mark dark blue.

Can you confirm that this is the behavior you’re seeing?

The dark blue change is something I put in because it was quite difficult to see the default “Focus” dotted line. If the Widget or its descendants are focused by the Player Controller, I set the image colour to be Dark Blue.

I just downloaded it when I got home and ran through the .uproject and then by building through Visual Studio and in both cases the highlighted button was not pressed when Pressing A.

Okay, kinda weird.

Downloading the project from that link and just running from the .uproject, the A Button works.

If I build with Visual Studio then the A Button doesn’t work, and also stops the A Button working when opening the project through the .uproject from then on…

Are you working with an engine built from source? I ask because I am prompted to build the project immediately after unzipping. I also noticed that After clicking a checkbox with the mouse - I can use the A buttonto click the same checkbox.

Moving left or right with the controller creates the selection box at which point the A button stops working. If I again click a checkbox, the A button begins working again. It appears the A button functionality breaks as long as the selection marquee is present.

Yes, the engine is being built from source.

I hadn’t even tested that case, but yes, clicking apparently does re-enable the A Button to work. Is there much difference between what happens navigation wise on the widgets when you click versus when you use the Joystick/DPad?

The main difference in click (mouse) vs DPad scroll (controller) is that with the DPad the new checkbox that I am hovering over gets a dotted outline around the box. While this dotted line exists, the A button is unresponsive on the controller.

Hi Sospitas,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.