Toggling widget visibility breaks buttons?

When I make two widgets, each has one button, I create them, add to viewport and when their visibility is toggled (with the Set Visibility node) in game, one of them won’t work after that. Is it a bug or am I misunderstanding something?

1 Like

Is it a bug or am I misunderstanding

Unlikely to be a bug. Consider showing us the script.

Usually when I hear that only 1 item works out of many (or the other way round), it is caused by incorrect iteration - like getting all and applying it to the incorrect number of elements only.

Again, without you showing us what is up, we can’t help.

Having granularity is useful, yes.

I’ll just add that the whole thing is exacerbated by the fact that the widget covers the entire screen - you can’t see it because no element represents it but the cursor can still trace against it.

If you were to set the size:


…it would work fine even it was set to Visible. Only the 64x64 would area would block stuff underneath.

And as it turns out, it also breaks one widget when I just do this:

After I toggle visibility I can’t click on the first button any more. The widgets are just two random buttons.

I noticed it on another project but then made as simple setup as I could. I also considered that maybe something else changes when “Set Visibility” node is fired but can’t see what other parameters it could possibly change to somehow disable the other widgets except one. It’s almost like the only widget working is blocking the others or something, but how could it be if I only change visibility?

Makes sense. It’s not a bug, it’s just something to be aware of.


  • for simple interaction like this, stick with Not Hit-Testable (Self Only) for the root, not Visible
  • for something more complex, this can be fixed by overriding the onMouseDown and passing Unhandled.

edit: the Not Hit-Testable (Self Only) is the desired flag in many circumstances as you generally do not want to interact with the root of the widget or the canvas the Button is sitting in; you’re interested in the Button, and that is already set to Visible.

Hope this makes sense.

The Long Version:

When you create those widgets, both buttons initially work OK because the root of the widget is set to Not Hit-Testable (Self Only) by default. You then override this setting to Visible thus forcing the widgets to consume ALL input.

When widgets are Added to Viewport, they are added in a specific Z-order (you can expand the node and amend it). The higher the Z-order, the more on top the widget is. If both Z-orders are equal (by default), the widget added last gets priority.

When you set them to Visible, the widget added last gets priority and since the root is now Visible, it hungrily consumes / blocks interaction to anything that is not itself and does not allow input to reach elements that now appear underneath according to Z-order.

Aah, I see, thank you, that works. I didn’t try that option because the tooltip said that it then cannot interact with a cursor, I thought that meant the entire widget, including all the components inside the widget. But yes, it makes sense to have the “Self Only” and “Self & All Children” options then too.