How do you set both bConsumeInput and bExecuteWhenPaused on an InputComponent->BindAction

I have the following code in my Player Controller:

InputComponent->BindAction("MenuUp", IE_Pressed, this, &ABasePlayerController::MenuUpPressedBinding).bConsumeInput = false;

But I would also like to have bExecuteWhenPaused = true.

How would I re-write that binding to make use of both specifiers?

Hey again :smiley: Try this

Hey again Moe :slight_smile:

No dice, I thought that would work as well but it doesn’t for some reason.

I just checked it, it works. Did you make sure that you’re assigning the variable by reference? as in “FInputActionBinding&”. it won’t work without the ‘&’.

Yep, this is what I did:

FInputActionBinding& Binding = InputComponent->BindAction("MenuUp", IE_Pressed, this, &ABasePlayerController::MenuUpPressedBinding);
	Binding.bConsumeInput = false;
	Binding.bExecuteWhenPaused = true;

With that I get the character stuttering issue again (explained in my previous problem), so it seems consume input is not taking effect.

Well it seems like it’s a project-specific problem because it works in a blank project, so maybe you could tell me more so i could reproduce something resembling what you have set up so i could try and help with that stuttering issue?

Again you are right!

The mistake I did in my project was to re-use the Binding reference as I have a lot of these action bindings, so I set it up like this:

FInputActionBinding& Binding = InputComponent->BindAction("MenuUp", IE_Pressed, this, &ABasePlayerController::MenuUpPressedBinding);
	Binding.bConsumeInput = false;

	Binding = InputComponent->BindAction("MenuUp", IE_Released, this, &ABasePlayerController::MenuUpReleasedBinding);
	Binding.bConsumeInput = false;

I thought it would be okay to reuse the reference, but it seems I was mistaken in that. So I guess creating a new reference for each ActionBinding is the way to go.

Thanks again!