[Help] After changing mouse cusror display, a click is required to regain control.

Using blueprint scripts, if I hide or un-hide the mouse cursor (either via ‘Set’ or via Controllers), I have to click anywhere in the game display to regain control of the game. Before that one click, no mouse input is processed at all. I’ve been Googling this issue quite a bit and I’ve seen a few others with this issue, but no one has been able to completely resolve it.

Has anyone had luck figuring out a way to get around this or resolving the issue using blueprint scripting only?

Things I’ve tried so far without luck:

  • Change Game/UI input appropriately
  • Explicitly set focus to a widget and/or viewport

It seems the issue might occur primarily when slate widgets are involved. The following thread details a user having a similar issue. It seems another user may have fixed it via C++, but I’m not sure how to translate that code into a blueprint script.

Any help or suggestions are appreciated!

Thanks.

Hello,
Have you try : “set input mode game only” and “set focus to game viewport” after “remove from parent” ?

2 Likes

I tested that just now. It hides the mouse cursor OK, but I still have to click somewhere in the viewport to gain control.

I’ve attached images of Menu->Game transition and Game->Menu transition.

I tested again, as long as I don’t change the visibility of the mouse cursor at all, this issue never happens, but that’s not very useful. Strange!

i supposed that you were using an ui and toggling mouse to get back in game but now i see this is not that.
If you don’t have widget to remove, you don’t need “remove from parent”.
If you open a new level do this set on event begin play in level blueprint.

If I don’t have the ‘remove from parent’ during the level transition, the slate widget remains on the screen, even after the other level (Level1) is loaded and starts. Is there another way I’m supposed to be disposing of the menu widget?

I will try using the input commands connected to begin-play though and let you know of the results.

oh sorry i thought you not had widget as you didn’t connect a widget to the “remove from parent”

The ‘remove from parent’ is in the widget blueprint itself. It appears to reference ‘self’ automatically.

It’s quite possible I’m doing that in the wrong spot too, but it seems to work. :confused:

Ok. personaly i do :
On event begin play : create widget and create a reference from return value.
from right mouse click : flip flop : all mouse events true (show mouse cursor / over / click events) / add widget to viewport
all mouse events false / reference “remove from parent” / set input mode game only / set focus to game viewport
and i toggle to inventory with mouse active to game with mouse no more active without click needed.

1 Like

OK, I’ll try that order out and let you know how it goes. Thank you for the advice.

OK, with some tweaking, this totally worked.

For anyone out there who runs in to this issue, Do as Fen said and have (on play event) a Set Input To Game (or UI/Game) and then a Set Focus to Viewport. The one caveat I’ve found is you MUST specify the player controller in the ‘Set Input’ node or nothing happens. Use Get Player Controller.

This is SOLVED! Thank you so much, Fen. :smiley:

I forgot about player controller, sorry.
Anyway, i am happy that helped you ^^

Possible to post a image of the blueprint ?
Can’t seem to do it with your explaination.
Thank

How to Fix Extra Click Issue In Unreal Engine 4: http://www.youtube.com/watch?v=RvDHS5KOn58