Can you disable a specific binded action then re-enable it?

I want to prevent the player from using a certain action when something else happens but still allow them to use a different action. Then I want to re-enable the action afterwards.

I’m assuming you are talking about binding events to an input component, you can do it like this:

	PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump);
	PlayerInputComponent->BindAction("Jump", IE_Released, this, &ACharacter::StopJumping);

	PlayerInputComponent->RemoveActionBinding("Jump", IE_Pressed);
	PlayerInputComponent->RemoveActionBinding("Jump", IE_Released);

But I need to remove and re-enable it in a different function which doesn’t have access to the PlayerInputComponent pointer.

Just declare a UInputComponent variable (protected) and set it in the SetupPlayerInputComponent function. Then can bind and unbind anywhere.

I’m still confused. I have the SetupPlayerInputComponent function which already takes the UInputComponent pointer PlayerInputComponent which I think is the default variable done by UE, right? So should I replace its name with a different one declared in my header file? Would I not need a cast to do that?

Since you’re setting the input component in the character and not in the controller, I tough you wanted access to the Input Component, outside the SetupPlayerInputComponent function. Did I misunderstand you?