Thank you for your information and time. I was able to reproduce this issue. I have sent a report (UE-5534) to the developers for further consideration. I will provide updates with any pertinent information as it becomes available. I also have a workaround that may work for you. The following example was done in my character. I hope this helps
There have been no updates to this issue containing any pertinent information, however the workaround listed above could prove viable. I hope this helps.
My issue is slightly different.
I have the mouse cursor being activated when I hold down the right mouse button, and being hidden again when I let go.
When I let go, the game window loses focus, and I have to click on it to regain mouselook.
If I use a key instead of a mouse button for this action, it works as expected.
I’ve worked around the problem by drawing the mouse cursor manually as part of the HUD, which also has the added advantage of allowing custom cursor art. The movement is not as smooth as a real cursor, though.
I believe I may have a solution to your issue with losing focus on the game screen. If I understood you correctly. You want to show mouse only while holding down the right mouse button and you would like the screen to follow the mouse at all times. I hope that this helps.
The input nodes can really help when it comes to setting the focus where you want it.
If you want to look around with the camera using mouse XY movement, when “show mouse cursor” is set, the RMB needs to be held down (otherwise mouseXY input axis events only ever output 0 value for the mouse movement).
When changing “show mouse cursor” to set/unset, the mouse looses focus in the game/player editor (PIE) window, meaning you have to click in the window for the mouse to regain focus and have in-game control (not a clean finish for the end user).
Fixes:
Use the “set show mouse cursor” node in your player controller blueprint to dynamically set and unset it (e.g. unset it when you enter your “free-look” mode, then set it again when you exit free-look and have your mouse cursor back again).
Then use the “Set input mode game only” node when you enter your free-look mode (to refocus the mouse to be in game without needing the extra mouse click). Then use the “Set Input Mode Game and UI” when exiting free-look mode to refocus to both in-game window and HUD widgets.
Below is the example in my player controller… hope it helps…!
If you are referring to the example given to Nameless Voice then setting the mouse does not necessarily matter. The example given was specific to what Nameless Voice was trying to achieve. Setting the Input mode Game Only will allow you to give focus to the mouse. I hope this information helps.
Sadly none of these solutions work without clicking the mouse cursor again. If you have a setup such as “Press E to show the mouse” it will always require a click with anything posted here.
I went a head and double checked on this issue for you and it appears that this issue has been resolved internally and will be available in a later release of the engine. I hope this information helps.
I have tested this issue in the 4.8.1 version of the engine and I have updated the report. I have also found that the workaround (setting the input mode to game only) still works. The reason that this is the case is because when the input is set to UI only when the user clicks the screen while the mouse is showing. So when the mouse is hidden again the input mode is still on UI only. This is why setting the input mode to game only when the mouse is hidden alleviates the issue. I hope that this information helps.