4.6 Mouse not locked to game window/screen

Hi there,

I’ve had the same problem with a number of test projects I’ve started - the mouse doesn’t get locked to the game windows or full screen. Thus, the cursor can escape the game window (or the screen if you have multiple monitors) and if you happen to click in a situation like that the window loses focus. This is particularly annoying if you’re using a multi screen setup as it can set the mouse focus to anything you might have open in the background.

I’ve read various workarounds but none of them solve the problem and it occurs for different templates, as well.

What’s interesting is that I packaged a build of a project that did not have this issue BUT playing on a different computer the mouse wasn’t locked to the game window, thus making the game pretty much unplayable.
Further, this happens in PIE (new window, selected viewport) and standalone :frowning:

Is there any reliable way to fix this?
And since I’ve seen it brought up quite a lot is it something that’s being looked at?

EDIT: This project is blueprint only by the way.

I’ve run into this as well. I’m not sure if it’s been fixed in 4.6 or not I will test it and see.

I just tried it with 4.7 Preview 2 and I still have the same problem.

In this test I added a Set Focus to Game Viewport node but it just won’t work - If I move the mouse enough, the cursor becomes visible outside the game window and then the window loses focus when I click.

Hi ,

Have you tried this in a blank project with no additional content? If no, what type of project are you seeing this in? Does it occur in PIE or is it limited to standalone game/packaged game/new viewport?

Hi ,

the project is based on the Blueprint Third Person template (although the problem occurs with other templates, too). I tried it with a completely fresh project based on that template earlier. I literally just created a new project and packaged that ‘for shipping’.

It’s the same result - the mouse escapes the game window (or the screen that runs the game fullscreen) and clicking shifts focus to whatever is in the background.

This does occur in PIE as well as standalone/packaged/new viewport. Ticking/Unticking ‘Game gets mouse control’ doesn’t seem to make a difference, either.

Hmm… on my machine you would see the cursor appearing outside the window while turning and then obviously trying to click would lose the focus on the game window.

I’m not setting mouse capture anywhere. I assumed it’s something that works out of the box as part of the Blueprint template?

What would I have to look at to set it manually?
Is there a particular .ini setting that would have to be set?

Unfortunately I haven’t been able to reproduce this on my end. I’m attaching a video showing what I am seeing. link text

Where are you setting your mouse capture (note: This project has had no alterations to base properties, so it may be that one of your .ini files has been altered).

Update: I’ve tested it with several different projects now and it seems like this only occurs when Unreal Engine 3/UDK is running in the background (which I probably shouldn’t do, anyway).
Can anyone reproduce this?

Interestingly, if I’m running a lighting build in UDK and my UE4 project at the same time, the cursor stays in my UE4 window.

Hi ,

I was able to reproduce this with UDK open and have entered a bug report, UE-7620, to be assessed by the development staff. For now and in general I would highly recommend not having both UE4 and UDK open at the same time.

I’m having this same issue with version 12.3. It also only happens when the UDK is open in the background.

Hi BinaryBench,

Thank you for this update. I have updated the bug report to reflect that additional users are experiencing this error. The only known workaround is to keep UDK closed while using UE4 at this time.