4.7 Lock mouse to viewport problem


mouse lock seems to disappear after any mouse button is clicked. To reproduce:

  1. Create a new project based on top-down example.
  2. In TopDownController-blueprint, hook a “Set Input mode Game and UI”-node to Begin Play-event and check “Lock mouse to Viewport” with a reference to self as target.
  3. Play in editor

mouse is properly locked to viewport until a mouse button is clicked, which removes lock. A fun observation is that it works if we turn default cursor to “none”, leaving us with proper locking but no cursor. I’m fairly sure this isn’t working as intended (it worked in 4.6), though if it is how can I force cursor to stay locked to viewport?


Hello ,

Thank you for informing us about lock mouse feature within ‘Set Input mode Game and UI’ not working correctly for you. For clarification, when you are dragging mouse during play in editor, is your mouse going out of bounds when you click and hold to walk character around, or is it not staying in viewport at all?

Detailed reproduction steps would be extremely beneficial for us to assist you with this issue, any additional information would be greatly appreciated.

Thank you!

Hi ,

After I first start play in editor (either via button or using ALT+P hotkey), mouse is locked to viewport. It stays locked until any mouse button is clicked (left, right, middle). simplest way I’ve found to reproduce issue is:

  1. Open UE-launcher
  2. Launch 4.7.1
  3. Create a new project (File->New project)
  4. Choose Top Down project and click “Create project”
  5. In new project open TopDownController-blueprint.
  6. Add this to blueprint:


  1. Compile and save blueprint.
  2. Click Play

mouse is now locked to viewport. Whenever a mouse button has been clicked ( click is released) lock is removed and I may move cursor outside viewport. While a mouse button is being pressed, it is however locked to viewport. issue is not only present while playing in editor, but also while playing in a standalone window.
If I open TopDownController again and open Class Defaults and set “Default Mouse Cursor” to None, issue is “resolved”, meaning that mouse stays locked within viewport, though I have no mouse cursor.
Hope that clears it up.


Hello ,

Thank you for providing me with exact steps you’re taking. I have successfully been able to reproduce this issue in 4.6.1 as well as 4.7.1. This is definitely an issue that has since been reported to our developers. UE-7293 is number you can reference if you’d like an update in future. At this time, it’s still currently being worked on however, it should be corrected in a future update.

Thank you again for your report.

This issues is still unresolved in version 4.8. Is there any anticipation to getting this resolved? As OP mentioned, this is an undesirable action. only hack/workaround that I can see is to lock cursor in each node group that uses a mouse action or to put it into ‘Event Tick’ which both cases are undesirable and should be unnecessary. Thanks.

Hey JT,

UE-7293 has not been resolved yet. It’s currently set as a major issue for 4.9. Unfortunately, I do not have estimated timeframe on when this will be implemented but you’re more than welcome to check in after each update and I’ll provide you information available.

Thank you and have a wonderful day! :slight_smile:

Just want to say I have same problem and it’s not fixed in 4.8.1 unfortunately…

I am having a similar problem. I’m trying to set up a basic toggle to go back and forth between using mouse to move cursor, and using mouse to move camera, and I don’t want mouse to be locked to viewport, but it stays locked at first anyway. Basically, it behaves exactly as explained, whether you set it to locked or unlocked.
Also, when I try to toggle back to using mouse to move camera, I also have to click again to be able to move camera. That’s really annoying and non-intuitive, and completely defeats purpose of trying to set up a simple toggle.

Thank you for notifying us that you too are having issues with this bug. I will make sure community interest on this bug is updated. Just as an update, this bug still has not been resolved and it is backlogged at this time.

If you have any further questions, please let us know. Have a great day!

Looks like this remains an issue in 4.9. Any update on status of this issue would be greatly appreciated.


This issue is classified as a priority 2, major issue. It’s currently backlogged and not resolved at this time though. Please check back soon for further information.

Thank you!

Any news on this being fixed in 4.10?

No update at this time. We will post here when we see any change.

Also when I set SetLockMouseToViewport(true); keyboard input is blocked. I think it’s wrong.

Any update on this we’re now at engine 4.11 and having same issues our game is a thirdperaon shooter but we need to be able to shoot near enough unrestricted in all directions problem is when trying to aim or move mouse cursor will eventually get to edge of game window then escape window causing several things to happen . Mostly you end up opening stuff on you’re desktop , you loose control of game and character game is basically unplayable like this .

UE-7293 is set as a major bug but it’s backlogged currently. I will update it to let our Developers know that it’s an important .


Just adding my voice that this would be nice to fix.

I had same issue. From this discussion, I resolved issue in my C++ project by adding one line in controller class’s SetupInputComponent function.


I found input mode change doesn’t work in constructor, so I put it in SetupInputComponent function. Now, things work as expected.

EDIT: Although this fixes issue with main window’s viewport issue, There is a strange problem where mouse cursor disappears for preview windows when click ‘play’ from BP editor window.

Major issue basically a game breaking bug if you have any type of game with mouse aiming in it and still no fix in five engine version . Coming epic stop releasing new features and fix stuff you already got first please .

I currently have this problem in version 4.12.5.