"Set Focus to Game Viewport" node broken

I’ve ran into issue where “Set Focus to Game Viewport” node causes cursor to lock to games viewport as expected, however I still need to click to regain mouse look. This appears to be an engine fault with both 4.6.1 and 4.7 preview 4. I’ve tried many work-arounds and re-ordering nodes with no success.

Hi

Using same setup as image you shared, SetFocusToGameViewport works without needing to click in viewport. Are there any steps or setup that you may have left out? Are you able to reproduce this behavior in a new project, or does issue only occur in your current project?

2 Likes

Hi

We haven’t heard back from you yet, so I am marking this post resolved for tracking purposes. Please let us know if you are still experiencing this behavior, and we can continue investigating. Thanks!

Hey this has not been resolved in latest preview unfortunately. As states node appears to work, and appears to lock our cursor to screen as well as hiding it, however to gain control of look direction we need to click once

1 Like

Hi

Can you answer questions asked above? Additionally, does this occur when playing in editor, or only in a packaged project?

I’ve been having same problem since upgrading my project to 4.7. (Currently running 4.7.3) It also affects packaged projects running on two different computers (both running Windows 8.1 with all updates).

I was able to work around issue by adding an arbitrary delay of 1 second before calling Set Focus to Game Viewport node. I would still consider this to be a bug because slower computers might require a different delay so it leaves me feeling a bit uncomfortable to just pick 1 second out of thin air and because it wasn’t necessary before.

A related bug that I’ve been able to reproduce consistently: mousing over task bar to show window preview and activate game window before game window has finished setting up causes computer to lock up and it has to be reset at power switch. I am using an Oculus Rift in extended mode in these circumstances (right screen, landscape flipped), have not reproduced issue without it. Specs: Windows 8.1 all updates applied, GTX 980 at factory settings, 32GB RAM.

I found a workaround to using “Set Focus to Game Viewport”. Try using “Set Input Mode Game Only”. That focuses viewport for me without having to click. Tell me if it works for you too. Cheers!

Hi jstarrdewar,

Please open a new Bug Reports post for issue with OR so we can track it there. Thanks!

Is this only happening with Clients in a multiplayer game? Can you reproduce issue in a new project? If so, please upload a test project somewhere that reproduces SetFocusToGameViewport bug and let us have a download link so we can look into it. Thanks!

Hi ,

Unfortunately, OP was already using that node. I still can’t reproduce this, though. Can you show me setup you were using that didn’t work? Thanks!

In my project, this happens when changing to mouse mode and click on somewhere. If not click during mouse mode, it will not cause problem.

Hi SCASL,

Are you able to reproduce this in a new project? If so, could you upload a small test project somewhere and get us download link? Thanks!

I’m getting this too, but only on server in a multi-player game with a listen server. For clients node works fine.

Is this in PIE or a packaged game? Is it on same system, or multiple connected systems?

One system, Play In Editor. I haven’t tested on a packaged build yet.

Basic flow:

  • in Player Controller, intercept input key command
  • in Player Controller, create new UI widget which includes a text entry box, add it to HUD
  • in UI widget created, on Construct, set keyboard focus to text entry box.
  • in UI widget, OnTextCommitted, run a Custom Event on Player Controller
  • in Player Controller, pull out text from widget, fire off a network call to server with text, then remove widget from viewport and Set Focus To Game Viewport.

On clients, this works fine. On Server, after this is all finished, viewport is receiving mouse input (you can look around) but not keyboard input (you can’t move). As soon as user clicks their mouse (even though cursor is not displayed at any point), they get keyboard control back.

Hello ,

I was reading over your post and I saw that you said node “Set Focus to Game Viewport” was only working on client. If you read tool tip for this node you will see that it says that this node is a client only node. If this is not what you meant could you provide exact steps that you have taken to reproduce this issue on your end so that we can make sure that we are reproducing same issue.

Tool Tip:

42753-setfocusclientonlyhelp.png

Make it a great day

I do see that tooltip. However, my question is: how am I supposed to set focus to viewport when on a listen server? That player needs to be able to focus into their viewport after using HUD too. Why is this restriction in place?

Would love a response to this!