I am using ver 4.3 and using Blueprints and I want to read the MouseX value in my PlayerController when the game is paused (in the ESC menu). The event is set to tick during pause and in fact it does tick but the value does not update, it stays on 0.0. But as soon as I push one of the mouse buttons the value starts to update. After that it works as expected, while the game is still paused.
So, I’d like to know if there is a way to have that value update constantly without having to push a button first while paused?.
I’m not exactly sure what you do with it but maybe setting the two variables “bShowMouseCursor” and “bEnableClickEvents” will help you.
They will release your cursor from the game (enabling to leave the screen) and enable click events which allow you to create a pause menu and make it clickable while the game is paused.
Check out the HUD level in the Content examples from the marketplace to see how exactly this is used and how it works. It is in the BP_HUD_Example blueprint.
The problem I have is not with click events or any of that. All that works just fine. The reason I want the actual Value from MouseX Event, is to detect mouse movement. I have a menu that can be used with Mouse or Keyboard or Gamepad. When I use the Keyboard, or Gamepad, I want to disable the Mouse Cursor and then when I start using the Mouse, I want to enable the Mouse Cursor.
So, in ver4.2.1 my setup for that worked great. As soon as I detect any value greater than “0” on the MouseX Event, I enable the Mouse Cursor. And then with the Keyboard controls, as soon as I get any input from the directional pad, I disable the Mouse Cursor.
So, now in ver4.3 none of that works as before. The mouse seems to not always update the value on MouseX Event. The whole system kind of relies on that one thing.
Also, with that said, disabling the Mouse Cursor with Keyboard input, also doesn’t work as before. It’s like, it doesn’t register the setting unless I set it using the mouse. So I click my menu button using the mouse, it will work every time, but if I run the menu button event with the keyboard, which is the same set of events, the Mouse Cursor stays on screen, even during game play, until I touch the mouse, then it disappears. So, it’s like the mouse is not updating unless you move the mouse, which kinda makes sense, but I need it to always update until I disable it, if that makes any sense.
I just want to say again that all this worked in ver4.2.1 without any problems. So something with how the mouse updates is changed in ver4.3 and I just wanted to know how to get around that, if it’s even possible. I’ve tried everything I can think of and I can’t get the reaction that I want, like I had it in ver4.2.1.
The mouse cursor has some general problems with how it updates. It only updates if you move it or sometimes only if you press a button.
The problem with this is if you want to control the cursor display with the keyboard or game pad, based on what input you’re using, it’s not really possible. You have to use the mouse to influence the mouse. Which kinda makes sense, but also isn’t very useful.
This is really long ago so I don’t remember all the details and engine versions, but in older versions it actually worked just fine, but in newer versions it does not. So something on the mouse side changed some time and now it isn’t possible anymore to control how the cursor is displayed unless you actually use mouse input.
If I want to switch off the cursor, using the keyboard, it doesn’t update that unless receiving mouse input. That’s not useful since I don’t want to use the mouse while using the keyboard. It doesn’t matter if the game is paused or not paused. That isn’t a factor actually.
Have you tried detecting a change in X and Y on Tick using the Get Mouse Position node? I’m not entirely clear on what you’re looking to do, but it sounds like you want the cursor to become hidden when there has been keyboard input, and unhidden when the mouse is moved. If so, this method should work without requiring any click input from the mouse.
If that doesn’t work for you, please explain in further detail what you’re looking for and we’ll see how we can get it working.
I’ll be honest, I don’t remember ever trying this through a Tick Event. I don’t think that I have, so I’ll give that a shot.
Currently I’m using a button press event and a MouseX event to detect the 2 inputs and set the appropriate settings. Will definitely try through Tick Event and see what happens.
I’ve made a post on the forum and posted a video to explain this more clearly. Hope this helps understanding the problem. Maybe I’m just not doing it correctly but I hope the video will clear things up to show exactly what the problem is I’m having and maybe there’s a solution for me. Or maybe it’s a bug?.
Sorry for the delay in response. There are a couple of issues that are preventing you from getting what you want:
There was an issue with mouse focus that made a click necessary before cursor updates were processed. This was reported in TTP# 331391 and has been fixed in 4.5. So if you use, for example, the Show Mouse Cursor bool to update whether the cursor is visible, it will update on the next tick. You can already see this in the 4.5 Preview.
There is a separate issue with mouse data nodes not updating during pause. I have entered a new bug report in our system for that (TTP# 349081) so the developers can take a look at it.
In 4.5, I set up a simple test case to show how I would set this up:
As you can see, using SetShowMouseCursor and GetInputMouseDelta on Tick (or Timer) eliminates the need for a number of extra variables and cleans things up significantly. Unfortunately, until we have a fix in for the mouse data updating during pause, this won’t work precisely how you need.
I’ll let you know when I see an update on that second issue. In the meantime, please let us know if you run into other issues with this that I may have missed.