UE4 Enabling Mouse During Play? - unreal-engine4

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?

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.

There are 3 blueprint nodes that change the input method:
Set Input Mode Game
Set Input Mode Game and UI
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.

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

Related

Change controls of a camera actor in Game Mode

I'm attempting to follow a beginner tutorial on UE5 but I'm currently stuck very early on.
Since I'm using an AZERTY keyboard I'm trying to change the control of UE to fit my needs, I had no problems re-binding the viewport camera controls, but once I click "Play", the camera actor is only responding to WASD controls, and I cannot find a way to switch it to ZQSD.
The project I'm on is a simple blank Game template, so there is no actual PC when I click play, it's just a camera that I'm trying to control to move around my world.
As suggested in several other posts, I tried going to Edit > Project settings > Engine > Inputs > Axis Mappings and creating a MoveForward mapping for Z with 1.0 scale (and for S with -1.0 scale, on my second attempt) but nothing is doing the trick...
Looking for some help on that one, thanks!
If you have not provided an Overridden Pawn for the PlayerController to possess in the GameMode Override default classes. You will have spawned a DefaultPawn.
The DefaultPawn has hard coded Input Controls that cannot be changed.
I suggest that you create your own Pawn with its own Controls that you can then decide on what Input Keys manage particular Input Actions.

Moving mouse cursor with gamepad question

So I can create a gameobject that I can move around like a cursor with my xbox controller, however when it comes to pressing buttons I have 1 issue.
It seems there is no way to set the actual mouse cursor position without importing user32.dll and even that solution will only be a windows solution. https://answers.unity.com/questions/330661/setting-the-mouse-position-to-specific-coordinates.html
The reason I want to move the actual mouse cursor as well as my gameobject representing a cursor, is that I still want to be able to click buttons, and when I call Input.GetMouseButtonDown(0); it will click the button at the point where the actual mouse cursor is, and if the actual mouse cursor isnt moving with us its not gonna work.
Also I dont need a custom mouse cursor, if the xbox controller could move the mouse cursor directly thats fine too.
Any advice appreciated.
There is no other way to set the mouse position maybe if you needed to have a solution for mac as well you can find it here at the bottom.
also making a custom cursor is a better solution cause it will be cross platform and you could make a custom mouse down event for it so i don't see why you wouldn't
and if you are sure you need the actual mouse to move you only have the first solution
and moving the mouse with xbox controller by using a software is only gonna work on your pc and those softwares are probably using the first solution

How to update runtime scene via the editor

Is it possible to update the' position/rotation of an object in a running game by setting its properties in the editor. In other words, when I change something in Unreal editor I'd like to see it change immediately in a running instance of the game.
Yes, it is possible. Steps to do so (tested in 3rd person template, UE 1.17)
Play in editor
Hit Shift + F1 to show mouse cursor and unlock from viewport
Click on Eject button (it is on upper toolbar where Compile, Play and Launch buttons are.
Click on mesh on scene and edit it's properties
Hit Posses button (now instead of Eject)
Play in modified world
Be aware that editor will show some warnings if you move Mesh with Static Mobility. Also, shadows could be off (especially if you are using pre-built lighting).
EDIT: there is another procedure: instead of PIE, you can start Simulate (Alt + S). Then you don't need to do Unposses / Posses actions, just edit properties. There is a catch - your game needs to be playable in Simulate mode. From my experience, due to various reasons I couldn't run one of my game in Simulate, so I had to repeat that 6 steps I mentioned earlier.

How to make Unity Play Mode NOT force screen focus to Unity Editor?

The Unity project I work on takes a moment to run after pushing Play. Often times I'll hit play, and while it's thinking, will click into another window (I'm always looking up data I need to verify in the game). So while I'm looking at something else or typing something, Unity will wrest control of the screen and force the cursor into Unity editor and make Unity the focused window on my screen once Play gets going.
Is there a way to turn this off? I want to be able to hit play in Unity editor, and be able to ignore it and have it run like any other window, doing its thing where I left it. I don't want play mode to force the Unity editor to become the focused window.
In recent Unity versions, the Game window has a dropdown that says Play Focused, change it to Play Unfocused.

simple UI menu and canvas for DK2

I am using Unity 5.1.2p3 with DK2 SDK 0.6.0.1 and I understand from this post that Screen Space - Overlay is not supported in Unity VR. It is recommended to use Screen Space - Camera (which in my case does not work) or World Space (which I am using now) but I need someone to help me understand how I get simple menu with buttons and toggles to show as a still image and how I can make selections and button presses with my mouse cursor.
I have created a menu for my app, with 4 toggles and 1 button. When I check the Virtual Reality Supported option with the Oculus being in Direct Mode and Canvas being in World Space, I can see it in VR, but I cannot see/find my mouse cursor to tick one of the toggles.
When I take off the headset, on my monitor's Game View tab, I can see and even use the mouse and select a toggle. Obviously, I have to keep the headset steady, so in my Game View, things do not shake!
Another thing I notice is that the VR camera is the same as the Main Camera in the Unity Hierarchy, but when I take off the headset and move it around, the position of the camera does not change, only looking up and down and around is reflected.
How do I simply do a static menu like a 2D surface that does not move in VR and a user can use button presses and muse clicks with the headset on? What settings are required for this way of doing UI and canvas stuff? There are 2 attachments, showing my current settings...
Are you specifically wanting to use the mouse? If you look through a blog entry I wrote below, it will show you how to use Gaze looking to trigger menu buttons:
http://talesfromtherift.com/vr-gaze-input/
You can achieve this by some code I list there that raycasts from the center of the screen and if it hits any UI, it will trigger the correct events and make it clickable by button (or by time).