"Set Input Mode UIOnly" problem within a widget

I want to do the following. Open a widget when I hit a button and close the widget when the same button is pressed again. Everything is working, well mostly. Except one little thing. I ran into the problem of my character still moving when the widget is opened and the need to rmb the mouse to get back into the game once the widget is closed. So I came across this solution.

The first thing I did was adding a “Set input Mode Game Only” as seen on the attached screenshot. This works fine. No need to rmb after the widget was closed. Then I added a “Set Input Mode UIOnly”. This is where my problem starts. When I open the widget everything is ok. I have the mouse, wich is locked to the viewport my character isn´t moving and I can click the buttons within the widget. But I can´t get out of the widget anymore when I hit the Y button. I also tried different keys.

I have the vague impression the key is not available because I´m not in game mode anymore. But i´m not sure and I don´t really know how to go on from here. Any help is much appreciated.

You are correct so say that it is because you are no longer using game input. I suggest you just disable movement/look input using a Boolean when you spawn the widget, and re-enable it after closing it.

Thank You, I ´ll give it a try. I may have some further questions in the process of getting this to work.