Switching "show mouse cursor" from on to off loses focus in PIE window

Win 7 64, 4.5.1

Here’s my node setup:

I’ve narrowed it down to the ‘show mouse cursor’ bool causing the issue.

Repro:

  1. Switch to mouse control (in my case by hitting “I”)
  2. Click anywhere in the game window
  3. Switch back to freelook by hitting “I” again
  4. PIE window loses focus

Hello ,

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

Make it a great day

Hello,
has this bug been fixed by now?
Thanks!

Hello Daniel W,

I went ahead and double checked for you. There have not been any updates on this issue.

Just came across this issue in 4.7.

I’m quite sure this didn’t used to happen back in 4.2.

Hello Nameless Voice,

There have been no updates to this issue containing any pertinent information, however the workaround listed above could prove viable. I hope this helps.

Make it a great day

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.

Hello Nameless Voice,

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.

Make it a great day

2 Likes

Set Input Mode Game Only fixes it, thanks!

Hi, thanks Rudy, the above works as a work-around for me too…

Can you explain what the workaround is?

I’m actually toggling showing of mouse cursor on the player controller in C++ code when my guy hits the toggle show inventory key.

And this happens in Standalone for me under 4.7.

Hi ,

2 issues:

  1. 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).
  2. 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:

  1. 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).
  2. 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…!

Are there any updates on this? I’m also unclear as to why the workaround works - why would it matter how we are setting the “show mouse cursor” bool?

Hello ,

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.

Make it a great day

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.

Yeah, this is a major bug if you want to ship a professional looking game. I’m not sure why it’s still an issue after 5 months :confused:

Hello ,

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.

Make it a great day

This issue is still there in 4.8.1 though workaround of setting input mode work

Can we get an update on this for 4.8 please? As stated above, this is the kind of bug that prevents shipping a finished product.

Hello ,

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.

Make it a great day