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.
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.
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.
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.