Cant click buttons of widget by 'Set Input Mode Only'

hi everyone, I am doing a game which is similar with minesweeper. The pic below is my main game interface. The left part of the screen is game area and player can click each grid to uncover it. The right part is HUD part and in this area I set some buttons (110%, 150% etc) to gain more score. To switch the mouse cursor in the whole screen, I use ‘Set Input Mode Game Only’ and ‘Set Input Mode UIOnly’. If the y-axis is less than a value, GameOnly. Otherwise UIOnly. The level BP is below.

However, during the game, I can always click the grids in the left area but cant click buttons of widget(I can detect them when I cover them because I set different pics for buttons). If I remove the branch part here, I can click buttons if I click the widget part first when I enter the game. If not, I cant detect the widget.
Can anyone help me solve the problem to make sure buttons work during the game?

Hi there,

had similar issues with the InputMode. The problem is that the input somehow gets messed up within the frame where you set the InputMode. And somehow the whole InputMode setup feels like it stacks the settings so you want to avoid calling it twice.

You have troubles because you set the InputMode every Tick. Here my sample how to avoid this:

Btw, you will need to check mouse position by viewport size to avoid position issues. Perhaps you need to count in Menu scaling as well. I just recommend you to check different viewport sizes to avoid surprises :slight_smile:

And I wonder if you have any reason not to use “SetInputModeGameAndUI” which actually works pretty well? (at least with the TestButton in my ThirdPersonExampleMap)

hope that helps :slight_smile: Marooney

Hi, according to pic1, If I add doonce before InputMode Setting, The game can not run successfully. If I only add set InputModeGameAndUI after eventbeginplay, the right widget can not be detected after I click the game area. :frowning:

Be sure i have tested this to figure out the solution for you :slight_smile: So in the end it will work for you :slight_smile:

So first things first: Do you get the PrintText messages when you move between Menu and Game?
Or do you set the InputMode somewhere else before too? (Perhaps in another level before) Because this messed things up for me too in my projects.

Perhaps you want to create a new blank TestLevel and a simple widget with a button (PrintText on click) as i did, to recreate my sample on you side. So if it works you can then easily check for any difference in execution within your actual game for yourself :slight_smile:

It does work! Thx :slight_smile: