How to refresh Inputs in paused game?

Hi,

I have my Character/PlayerController class that can Tick while the game is paused (using PrimaryActorTick.bTickEvenWhenPaused = true; in their constructor). However even with that, I’m unable to receive inputs other than from my gamepad stick. Even my mouse is stuck. Only my DebugExecBindings are working when the game is paused.

So for example I have :

In DefaultBindings.ini :

+ActionMappings=(ActionName="Start", Key=Enter)
+ActionMappings=(ActionName="Start", Key=Gamepad_Special_Right)

In Character::SetupPlayerInputComponent() :

	InputComponent->BindAction("Start", IE_Pressed, EPC, &AExilPlayerController::InputStart);

In PlayerController::TickActor()

   Super::TickActor( DeltaTime, TickType, ThisTickFunction );
	
	//Tick behaviors to run only when paused
	if( IsPaused() )
	{    		
		ProcessPlayerInput(DeltaTime, false);
		
		CheckWallRun();
		UpdateRotation(DeltaTime);
		UpdateCameraManager(DeltaTime);
	}

So as you can see I force the Input update manually in my TickActor() function. However, even with this call, only the stick of my gamepad are responsive, all the other functions linked via my binding are not called (I check with a log print).

Any ideas what I’m missing ? Is there another setting/function to call to update the bindings ?

By digging a bit more I found what I was missing :

		if (PlayerInput != NULL)
		{
			//Tick the Input handler
			PlayerInput->Tick(DeltaTime);
			
			//Process inputs
			ProcessPlayerInput(DeltaTime, false);
		}

So to be able to update your inputs you first need to Tick() the UPlayerInput object of the PlayerController class. Note that I had to add #include “GameFramework/PlayerInput.h” to be able to compile properly.

Everything works now. :slight_smile:

I tried everything exactly as above but ProcessPlayerInput wasn’t triggering my specially bound pause action.

Eventually I figured out that I can just do it on the blueprint side because if you click on an input event, there is an “Execute when Paused” flag.

Yes, I’ve found that too, quite important. Used it for the ‘ESC’ key that is required to work all the time. Attached an image for people who are confused :slight_smile:

Is there any way to set that flag from C++?

i think im using a different system with the new ue5 enhanced input but might help someone, in the data asset theres a tick box that says “trigger when paused” fixes it completley! im using the function UGameplayStatics::SetGamePaused(GetWorld(), true); to call the pause im c++