Some 'Pressed'-Events are omitted in 'Input Mode Game Only'

Hi there,

I want to start an action when I press my Left Mouse Button and stop the action as soon as I release the Left Mouse Button.

So here is what I did:

GameMode

104175-gamemode.png

Pawn

104176-pawn.png

PlayerController

Result

As you can see in the result, there are more ‘Released’-Events than ‘Pressed’-Events.
The amount of ‘Released’-Events is the amount of actual clicks.

I guess the main reason for this to happen is, that I set ‘Show Mouse Cursor’ to true while being in the ‘GameMode only’ mode.

So the question is: Why are some pressed events omiited?


My actual goal is to fire my weapon on the ‘Pressed’-Event and stop firing the weapon on the ‘Released-Event’. In addition my UI should still be seen, but should not be able to interact with. However I need my Mouse Cursor to be seen, since the Cursor is an indicator for my player in which direction he is moving.

The issue is that as soon as I show my Mouse Cursor I am able to interact with my UI.

Can I somehow also prevent my Cursor from interacting with my UI?

I mean I could also position a widget to my mouse position in a tick event. However I also read that this could feel kind of laggy and hardware pointers (or those which you can set in Project Settings → User Interface) are preferred.

Thanks a bunch :slight_smile:

Interesting that there’s exactly two releases for each press.

Yes, you can prevent the mouse from interacting with the world by calling the “Set Input Mode UIOnly” node from within a widget.

The amount of ‘Pressed’-Events depend of the intervals between my mouse clicks.

If I have an interval of 1 sec between my clicks, then you will see no ‘Pressed’-Event at all. Only if I spam my clicks some ‘Pressed’-Events pop up occasionally.


If I understand right, the ‘Set Input Mode UIOnly’ would block all inputs which I receive in my Pawn or PlayerController.

In my case, I want to have control over my Pawn/PlayerController and thus (GameMode only), but I also have to show my mouse cursor since its an indicator in which direction my player travels or if he currently shoots or not.

Some widgets should be visible (like healthbars and so on) while those who contain buttons should not be clickable in this state.

I guess I could use Input Mode GameMode + UI and then always check on ButtonClicks if I am allowed to execute that button, which I wanted to prevent since this would generate a lot of redundant code and would be really annoying to service such code of a longer period of time.