An LMB event is only triggered with a double-click ?!

Hello there :slight_smile:

I’m encountering a strange problem and couldn’t yet find a solution, albeit googling for hours.
Please have a look and try your best :stuck_out_tongue:

The plan here is as follows:
When opening the world map (not included here) you can place “markers” and remove them.
The InputAction is correctly set up, the marker actor that is placed is, too.

Now the problem with this is that I can click ONCE on the map, which gives me the “LMB registered” print AND places a marker… but when I click again, on a different spot, I cannot trigger the same thing with only one LMB, I have to double-click in order to get the “LMB…” print and the marker to spawn.
Same goes for the RMB for removing, btw.

The strange thing is that all this worked just fine until some hours ago.
I can’t remember what exactly it was that I’ve changed, but I’m pretty sure it wasn’t on the level BP, but rather some different BP classes.

What could be the problem here?

Thanks, in advance,

Abaris

EDIT:
The InputActions DO consume input, DO execute when paused and DO override parent bindings.
All of these values have been changed in a trial and error manner, already.

The map is not a widget but replacing the player’s camera with a “map camera”; the linetraces from this BP hit the ground - this worked everytime before.

2 Likes

Anyone? ( bump after 5 days )

I’m having a similar problem. I have a simple LeftMouseButton event wired to a Print node in my player controller. I launch in editor and my first click prints “Hello” as it should but after the first click I have to double-click to get the same result.
If I wire the Print node to a keyboard input it works fine, this seems to be just happening with mouse clicks whether its a bound input event or just a simple LeftMouseButton event.

I’m using 4.11.2. I’m wondering if this is a bug or if I changed a setting somewhere without realizing.

One more thing. This is also happening when using an actors OnClicked Event. I have Show Mouse Cursor and Enable Click Events turned on in my player controller. This suggests it has nothing to do with how I’m handling mouse input.

Aaaalright, after a LOT of trial and error I found a workaround that works for me:

I’ve forced “Set Input Mode to Game and UI” on all necessary points in all BPs that involve a click (or mouse focus, for that matter).

It seems the focus problem is solved by this and all LMB events trigger now, as intended.

2 Likes

WOW geez thanks for following up on this because I was goin nuts trying to fix this. Previously when exiting a UI, I used the node “set to game mode only” but switching this node to game mode and UI fixed this immediately.

Hi, I have the same problem, but I dont understand what you mean with “forced “Set Input Mode to Game and UI” on all necessary points in all BPs that involve a click”. Can you explain this?
Is this a bug or what is the problem? In a new Blank-Project is nothing of this Problem but if i copy my existing project in the new Blank there is the same problem.

Hi all, I was also experiencing this issue but had no idea what “Setting Input Mode to Game and UI on all necessary points” meant, but was able to google a solution in Project Settings → Default Viewport Mouse Capture Mode → select “Capture Permanently Including Initial Mouse Down” instead of “Capture Permanently”.

I hope this helps someone else =)

2 Likes

Yes that is it. Had this bug for a long time. Thank you.

Thanks that fixed it for me too.

Try using FInputModeGameOnly::SetConsumeCaptureMouseDown and sett it to false in the player controller. :slight_smile:

Thanks, Bro- Your solution worked for me as well.

Thanks! This image ended up being all I needed to do; added the Input Mode like this and done

I’m using the Shooter game as a base and my guns would only fire if i double clicked.

To solve it, in my ShooterPlayerController I remove the lines that set the InputMode:

void AShooterPlayerController ::SetPlayer( UPlayer* InPlayer )
{
	Super::SetPlayer( InPlayer );

	if (ULocalPlayer* const LocalPlayer = Cast<ULocalPlayer>(Player))
	{
   	...
		//FInputModeGameOnly InputMode;
		//SetInputMode(InputMode);
   	...

Set Input Mode Game Only does not reset an input mode to the default one.

It overrides this setting Default Viewport Mouse Capture Mode

You may want to implement a helper function. Something like this:

void MyPlayerController::SetInputModeGameOnly(
                                     bool InConsumeCaptureMouseDown)
{
    FInputModeGameOnly InputMode;
    InputMode.SetConsumeCaptureMouseDown(
        InConsumeCaptureMouseDown);
    SetInputMode(InputMode);
}

I recently faced the same problem.
Please check my blog post I wrote about it:

1 Like

Thanks!, that was exactly what I need, works perfectly!

Worked for me:
IF mouse-button-pressed THEN set-input-mode-game-only
IF mouse-button-released THEN set-input-mode-game-and-ui

2 Likes

In UE5 now there is the option to Set Viewport Capture Mode whit BP.
image

For anybody that stumbles whit this post using updated unreal.

1 Like

Thanks for this!

When you open the UI, you change the method.

Yep, work for me.