UE4 Enabling Mouse During Play?
Asked Answered
I

3

7

I'm extremely new to UE, and doing a few easy tutorials to get started, so I don't exactly know the correct terminology to use to help me find what I am looking for... Anyway, whenever I hit play and the game starts, my mouse disappears and I am only able to use the input that I set up; so my question is, even though I do not need mouse input for movement, as I am using WASD, how do I keep my mouse unlocked and available to move around without being locked to the camera?

Infeld answered 30/3, 2017 at 6:27 Comment(0)
S
13

When you hit play and the game starts, your mouse gets captured by the game to control the camera. If your play button is set to play in the viewport, you can release the mouse from the viewport by pressing Shift-F1. The game will still be running, but input (including from the keyboard) will be suspended and you can interact with the editor.

You can also change the default behavior of how the mouse is captured and it if is constrained to the viewport boundaries. To see these options, go into the project settings (settings button above main viewport/project settings...). On the left side of the project settings window, select 'Input' under the Engine heading. On the right side will be some mouse preferences that can change its behavior.

For instance, to allow the mouse to travel outside the viewport, change 'Default Viewport Mouse Lock Mode' to 'Do Not Lock'. I don't recommend this, but you might experiment with these to get a feel for what they do. Also, you might look up these settings in the Unreal documentation for more detail.

Severson answered 30/3, 2017 at 7:39 Comment(0)
B
7

There are 3 blueprint nodes that change the input method:

  1. Set Input Mode Game
  2. Set Input Mode Game and UI
  3. Set Input Mode UI

You want a combination of the second one and a "Show Mouse Cursor" node. However, if you are making an FPS and you use the mouse to look around, you may lose that ability with the second node above. It comes down to what your game is and how you want to use the mouse.

Brutal answered 30/3, 2017 at 11:21 Comment(0)
P
4

I had the similar issue. So I did something like this in Level Blueprints to achieve what I want.

enter image description here

Panoptic answered 12/7, 2021 at 14:13 Comment(2)
I'm actually surprised that works. Set "Show Mouse Cursor" is normally only available in a PlayerController context. And you don't need the FlipFlop - you can just enable or disable the Show Mouse Cursor parameter to get the effect you want.Finnish
FlipFlop isn't all that useful on a Begin Play node.Lebel

© 2022 - 2024 — McMap. All rights reserved.