[4.11 UMG Game & UI Focus] After a single click on viewport while in Game and UI, game viewport no longer receives clicks

Dear Epic,

After I upgraded to 4.11 I have a critical issue with focus in UMG that I can’t figure out how to resolve.

My game revolves around being able to use the mouse to click around the game viewport, and also click on UMG UI elements at the same time.

In 4.10 this worked perfectly via Set Input Mode Game and UI with no widget to focus

I could single click repeatedly on game viewport, or choose to click and drag UMG widgets around.

Now in 4.11, after I apply Set Input Mode Game and UI, after I click just once on game viewport, all single clicks after that 1 successful click are ignored.

However, I can still double-click, and get the game viewport’s attention (my player controller get’s the Left Mouse Button down event).

So my issue is that in 4.11 I can no longer do multiple single clicks of the game viewport and get the signal routed to the player controller Left Mouse Button key event.

After the first good click on game viewport, only UMG responds to single clicks thereafter.

Before the first Left mouse click on game viewport (aftering setting Game + UI), if I click on UMG instead, that will work too.

But after first click I lose all capacity for repeat single clicks to game viewport, until I use Set Input Mode Game Only

If I do the first successful game viewport click, and then lose capacity to do more single clicks, and then re-apply Set Input Mode Game & UI, then the following happens:

  1. clicks on game viewport make the cursor disappear
  2. I cannot move the mouse while left mouse is down after starting such a click

I fix this by saying dont hide mouse during capture

omg

I figured it out!

#The Solution

The issue was that when I made the Set Input Mode Game and UI, I forgot to include the player controller reference, since I was in the player controller itself.

You must make sure to use Get Reference to Self and include that too!

In 4.10 this was not an issue, but in 4.11 it is!

And also, in 4.11 you need to say dont hide mouse during capture

Here’s a pic!

#Victory!

As an extension of this, if you’re using these nodes outside of the player controller (for example, in the widgets themselves) this bug is still present. The solution to this is to set up an event in the player controller as so:


Then cast to the player controller and call this event from wherever you would have been using ‘Set Input Mode Game and UI’ in the first place.

Thanks - not sure if this would be something we could have solved without your initial solution.

Hello ,

I am happy that you have found a solution to the issue that you are having. I ran a couple of quick tests and this node appears to be working as intended. As for needed a self node, I was able to have it work by getting a reference to the player controller with the “Get player controller” node. I hope that this information helps.

Make it a great day.

“Thanks - not sure if this would be something we could have solved without your initial solution.”

You’re welcome!

#:heart:

Very nice to hear from you Rudy!

I am happy to give you solution credit since I dont get any for marking my own solution

#:heart:

Thank you . Setting the player controller reference helped me solve another UMG focus related issue too!

Bit odd how you can call “Set Input Mode …” from practically anywhere (even a level blueprint) and it compiles, but doesn’t focus right unless you remember to pass in a player controller as target.

In any case, thanks for the tip!

You’re welcome VSZ!

:slight_smile:

Thank you for posting your solution! I was stuck on this too, and I’m using 4.12. I also tried it in 4.13 and this issue is still there. I don’t see why we can only set the focus in the controller and not anywhere else with a reference to the controller, so I hope this problem is fixed soon!

#Clear Error Messages in 4.14

I submitted a pull request that was accepted for 4.14 to make this obvious to everyone via PIE errors (the ones that appear after you exit PIE) :slight_smile:

**UMG UI Input Nodes, PIE Errors, Github pull request by **

https://github.com/EpicGames/UnrealEngine/pull/2820

#:heart: