"Set Input Game Only" double click issue, suggested fixes not working

I recently added some GUI menus to my game, and stumbled upon an issue that people seem to have a had for a long time, that when you use the blueprint node “Set input mode game only”, the game will only detect the initial capture, and each subsequent double click, no normal mouse clicks. People have done some hacky stuff to work around it, but they don’t work right for my game mode.

I found someone suggesting to make another function to manually override the input to capture mouse input:

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

Which I call in blueprint on gameplay start and on player exiting menus:

Yet I still have to double click to capture the input. Any ideas?

Edit: For some reason it worked when I hardcoded the consume mouse input to false in c++, but not when i set it blueprint. (I realize I had it set to true in the picture above, but either way around made no difference) Anyway it works now!

Hi Graylord,

I think I had a similar issue a while ago.
In my case I have to swith between a player mode that needs a cursor (Isometric View with cursor) and one that captures the cursor (3rd Person Character).

There are multiple input modes you can set. As far as I know you can’t interact with Widgets in FInputModeGameOnly.
I think what you need to go for is the FInputModeGameAndUI or if you wish to suppress input from action or axis mappings FInputModeUIOnly.

You can switch between input modes during gameplay. To do this, you could implement a function similar to this:

void APlayerControllerBase::SetCursorEnabled(bool bCursorEnabled)
{
	bShowMouseCursor = bCursorEnabled;

	if (bCursorEnabled)
	{
		FInputModeGameAndUI InputMode;
		InputMode.SetLockMouseToViewportBehavior(EMouseLockMode::LockInFullscreen);
		InputMode.SetHideCursorDuringCapture(false);
		SetInputMode(InputMode);
		return;
	}

	FInputModeGameOnly CombatInputMode;
	SetInputMode(CombatInputMode);
}

You can then call this via an input mapping or a function in your UI (i.e. when a button is pressed).

Hope this helps :slight_smile:

2 Likes

I’m not sure if you found a solution, but I just recently had the same issue and this worked for me.

  • Add “Set Viewport Mouse Capture Mode” after your “Set Input Mode Game Only” node and set it to “Capture Permanently Including Initial Mouse Down” from the dropdown
5 Likes

@akevorkov thanks, that worked for me

Thank you @akevorkov and @DerDude16. Your both solutions help me to solve this problem.