Bug in UCommonUIActionRouterBase::ApplyUIInputConfig

Hello, we noticed that CommonUI is invalidating the counter for `AController::SetIgnoreLookInput` and `AController::SetIgnoreMoveInput` in the function `UCommonUIActionRouterBase::ApplyUIInputConfig` when adding a widget on the ‘game’ layer.

The current code makes calls to `SetIgnore*Input(false)` even if it had not previously called `SetIgnore*Input(true)` which invalidates the counter. Current code:

```

if (!OldConfig.IsSet() || OldConfig.GetValue().bIgnoreMoveInput != NewConfig.bIgnoreMoveInput)

{

PC->SetIgnoreMoveInput(NewConfig.bIgnoreMoveInput);

}

if (!OldConfig.IsSet() || OldConfig.GetValue().bIgnoreLookInput != NewConfig.bIgnoreLookInput)

{

PC->SetIgnoreLookInput(NewConfig.bIgnoreLookInput);

}

```

We were able to fix this code very simply by treating a previously unset config as false by default. This enforces the CommonUI system to always first call `SetIgnore*Input(true)` before subsequently calling `SetIgnore*Input(false)`, which will maintain the validity of the counters.

```

const bool bOldIgnoreMoveValue = OldConfig.IsSet() && OldConfig.GetValue().bIgnoreMoveInput;

if (bOldIgnoreMoveValue != NewConfig.bIgnoreMoveInput)

{

PC->SetIgnoreMoveInput(NewConfig.bIgnoreMoveInput);

}

const bool bOldIgnoreLookValue = OldConfig.IsSet() && OldConfig.GetValue().bIgnoreLookInput;

if (bOldIgnoreLookValue != NewConfig.bIgnoreLookInput)

{

PC->SetIgnoreLookInput(NewConfig.bIgnoreLookInput);

}

```

[Attachment Removed]

Steps to Reproduce

Do not add any common UI widgets at startup.

Create a trigger volume that, when a player enters the volume, calls `AController::SetIgnoreLookInput(true)` on the entering player controller, then open a common UI widget on the “game” input layer.

Observe that the opened widget negates the previous call to `SetIgnoreLookInput`.

[Attachment Removed]

Hi,

Thanks for reporting this, your fix looks good to me. I’ll see about getting that submitted to the engine for a future release and share a CL once it’s available.

Best,

Cody

[Attachment Removed]

Thats great news! I should also mention as an update, in order to make this change more fool-proof, before resetting `ActiveInputConfig` (e.g. in `UCommonUIActionRouterBase::HandleRootWidgetSlateReleased` line 854), we should check if `bIgnoreMoveInput` / `bIgnoreLookInput` is true and call `SetIgnore*Input(false)`.

Something like this (apologies for the if statement nesting, it gets pretty ugly fast):

if (RootNodes.Num() == 0)
{
	// Unset IgnoreMoveInput/IgnoreLookInput if specified
	if (ActiveInputConfig.IsSet())
	{
		if (ULocalPlayer* LocalPlayer = GetLocalPlayer())
		{
			if (APlayerController* PC = LocalPlayer->GetPlayerController(GetWorld()))
			{
				if (ActiveInputConfig->bIgnoreMoveInput)
				{
					PC->SetIgnoreMoveInput(false);
				}
 
				if (ActiveInputConfig->bIgnoreLookInput)
				{
					PC->SetIgnoreLookInput(false);
				}
			}
		}
 
		ActiveInputConfig.Reset();
	}
 
	RefreshActionDomainLeafNodeConfig();
}

[Attachment Removed]

Hi,

This should now be checked into mainline at CL#50465864. Thanks for the report!

[Attachment Removed]