UMG - Input handling, when there are multiple widgets displayed

Let’s say I have added to viewport one widget. It can interact with mouse etc, and it works fine.

Then at some point I add another widget to Viewport. I want this newly added widget to be able to capture mouse events as well.

But… it doesn’t work!

I can only interact with second widget, when the first one is not added to viewport.
Ideas ?

Are you “childing” the 2nd widget to the first? Maybe could be this.

Hm I don’t.

So You say I should create one full screen widget, and then parent to it all other widgets ?
Worth trying.

Don’t get me wrong, I said you “could” LOL.

My game now is working this way, a “one widget to rule them all” thing, I’m just “splitting” complexity among widgets related to each functionality, after, I place instances inside the “One Widget” in the own UMG editor, but I think that until by code this parent/child relationship means “who’s inside who”.

To manage what is shown or not I’m using a simple visibility toggle, but I think you could also create and parent/child them realtime.

Hope it works.

Added: Get a fullscreen “constant” widget doesn’t seen a so much crazy approach if you consider that our “mouse cursor layer” could be it.

Make the Canvas (the big blank area) of the widget “HitTestInvisible” so the underlying widget can receive input. Just because you can see trough doesnt mean you can click trough :). Altho the Childing Method is alot better for example if you have some widget windows wich you want to Zorder on click etc

Childing multiple widgets worked.
Though it’s hardly ideal solution still, it at least works! That’s enough for testing :D.

why isnt childing ideal?

What I usually do in these cases is that I create an enum in the character handling the menu with all the possible menus and use a switch to check on which menu you are on. Then you can just customize what happens in each menu.

yes or you use an overlay and multible borders so you can set visibility and have only 1 widget to deal with

Well it add some complexity, and at that point I’m not sure how to do moveable windows. But as I said, it’s more than enough for what I’m doing right now.

When you add your child to the present user interface. Save down a reference grab the Canvas Slot -> SetPosition. (easy spoken for the movement, might be doing a tutorial on moveable windows this we) The childing is an awesome feature. I can create a kind of Window styled widget with all the functionality (movement, close, minimize etc) and to that window widget you can add your special content widget. so you dont have to do the basic stuff over and over

Anything mutually exclusive that takes up identical screen space can also be done with a Widget Switcher