Listen for Input Action while paused?

Is there any way to let “Listen for Input Action” nodes still work while the game is paused? I’m using them to read inputs in UMG right now for some specific functionalities.

I’m aware I could dupe all my functionality in an actor that can receive input but that seems really time consuming and like bad practice. My only other thought was maybe avoiding true pause altogether and trying to use something with time dilation but that also seems like it could lead down another weird rabbit hole so here’s to hoping there’s a more straightforward solution.

2 Likes

Hello, with pause thats not possible, because you are basically freezing the game.

Other input can be read though so it’s not the freezing that’s the problem itself. It might just be the way the listen nodes are designed but that almost feels bug-tier, especially with the nature of how UMG is often going to be used.

By the way I ended up solving this by just spawning a new “Pause Manager” actor on pause with “receive input while paused” checked that listens for the appropriate inputs and calls the functions on the widget that it needs to.

Hey NineDGuy, can you show how you did the “Pause Manager” actor? I could not find the “receive input while paused” anywhere. or the “Pause Manager” actor.

If you are showing your pause menu with “Input mode UI only” which I had to do (forget the reason - though recommend trying to use Game and UI instead) then the only way that worked for me using the classic Input Actions was to check the input key state from the player controller on tick in the pause widget and essentially duplicate the action bindings and resume if any of them matched. I added a debounce of 0.1s from the initial pause state to prevent accidental immediate unpause.

“Resume” in first image is the normal function I invoke if the “Resume button” was ordinarily selected in the pause UI.

Note that “Gamepad Available” is a blueprint pure node I added in a utility blueprint classic that checks a bool on a derived game instance class I created to check if the controller is connected. It isn’t necessary if you aren’t supporting gamepad, and I probably do not need to check for it here as the “key” won’t be pressed if it isn’t on anyways.


After reverse engineering the ListenForInputAction function, I realized it misses a simple
NewBinding.bExecuteWhenPaused = bExecuteWhenPaused to work.

If you don’t have a custom engine version, you can create your own version of the ListenForInputAction function in a cpp class that descends from public UUserWidget, public IWidgetInterface


void UMyUserWidget::CustomListenForInputAction(FName ActionName, TEnumAsByte<EInputEvent> EventType, bool bConsume, bool bExecuteWhenPaused, FOnInputAction Callback)
{
	if ( !InputComponent )
	{
		InitializeInputComponent();
	}

	if ( InputComponent )
	{
		FInputActionBinding NewBinding( ActionName, EventType.GetValue() );
		NewBinding.bConsumeInput = bConsume;
		NewBinding.bExecuteWhenPaused = bExecuteWhenPaused;
		NewBinding.ActionDelegate.GetDelegateForManualSet().BindUObject( this, &ThisClass::OnInputAction, Callback );

		InputComponent->AddActionBinding( NewBinding );
	}
}

If your UMG widget has this class as a parent, you can then use this function that supports pause.

And don’t forget to set the owning player of the widget when creating it! Otherwise nothing will work.

1 Like

(post deleted by author)

Unfortunately, using your way, when modifying the parent class of the widget, the program crashes, which I tested under 5.3.