When I enable my mouse cursor, click around with it for a bit and then disable it through anything other than a mouse click, the mouse X/Y axis inputs do not function for anything else until a mouse click is made. Also if I hold down a mouse button while disabling the cursor, it works as it should.
How can I remove the need to click to re-enable X/Y axis inputs after the cursor has been disabled?
The blueprint I’m using to disable/enable the mouse is below.
I’m experiencing the same problem even in Standalone mode. For example::
Hit “F” key to bring up Inventory, enable the mouse
Successfully click on panels and whatnots
Hit “F” key to close inventory, disable the mouse
However, the mouse look does not work until I hit a mouse button. I ideally I shouldn’t have to do the extra mouse click to regain control of the mouse look.
to release the mouse control
bShowMouseCursor = false;
bEnableClickEvents = false;
bEnableMouseOverEvents = false;
Currently, i’m tracing down the states on why the mousebutton regains control in the code, but the hunt is slow. Any suggestions? I’m currently blocking out the following code area but I could be far off still :
Well, I was able to figure out the problem and the fix for the c++ side. Basically, the problem is with which slatewidget has focus and then to refocus back onto the clientviewport.
To release the mouse and regain “Mouse Look” for C++:
//Release the mouse events and don't draw the mouse
bShowMouseCursor = false;
bEnableClickEvents = false;
bEnableMouseOverEvents = false;
// Since the viewport may not be the current focus,
// we need to re-focus whatever the current focus is,
// in order to ensure it gets a chance to reapply any custom input settings
auto CurrentFocus = FSlateApplication::Get().GetKeyboardFocusedWidget();
FSlateApplication::Get().ClearKeyboardFocus(EKeyboardFocusCause::SetDirectly);
FSlateApplication::Get().SetKeyboardFocus(CurrentFocus);
Maybe you can use this information to figure out the blueprint method equivalents. Hope it helps.
None of these suggestions worked for me, but I found a way.
I noticed the Set Input Mode Target input didn’t have “Target: Self” like nodes usually do, but instead just “Target”, so I chucked a self ref on it and the problem was gone!, remove the self and it returns.