I have a sofa model in a blueprint. When I click on it, a widget is added to the viewport. In it I have some buttons, clicking on each the color of the sofa change and the widget expire, returning on my game. So on clicking to the sofa I’ve added Enable click events, Show Mouse cursor, Set game paused, Create Widget and Add to viewport.
It works right but when the widget is created, before I can click on my buttons I have to click on the screen, like if the widget is a sort of “window” not automatically selected. Same when I close the widget: before I can return to my game commands I have to click on the screen, like a not actually selected window.
How can I automatically activate these “windows”?
You just need to set the focus on the current widget. Here’s a screenshot showing how to do that:
When you remove the widget, you can call ‘Set input mode game only’ to bring focus back to game viewport. When adding widget, you can call ‘set input mode game and UI’ and connect the widget you want to be focused as shown above. Hope that helps.
Thanks a lot!