Is modifying bConsumeInput on the return from UInputComponent::BindAction() supposed to do anything?

I’ve got this code on a component I wrote:

UInputComponent* input_component = GetOwner()->InputComponent;
// Can be nullptr when simulating vs play.
if (input_component != nullptr) {
  auto result = input_component->BindAction(FName(TEXT("Action1")), IE_Pressed,
    this, &MyClass::Action1Behavior);
  result.bConsumeInput = false;
}

I’m trying to make the event NOT consume input, because I have many of these components in my level and I’d like them all to respond to the same instance of the same input. The components are getting input in this situation from other events which they do not share, so it is not an issue with whether the components are set up to receive input. When I’m debugging in VS I can see that the above code gets executed on all instances of the component, but the function that I bind is only called on one instance of the component every time I trigger the input event. It seems like setting bConsumeInput isn’t doing what it is supposed to here, is there a way to accomplish this?

Need to know ASAP

Still need to know ASAP.

This is holding up my work for a deadline on Thursday…

Still need immediate help.

No. Modifying the value of a local variable just before it goes out of scope does absolutely nothing. In fact in a development build you probably cant set a breakpoint on that line. It will have been optimized away.

However if you made it a reference, referencing the real result, and not a local copy then it might do something.

auto result ← this is of type FInputActionBinding

auto& result ← this is of type FInputActionBinding&

And the reference is into the internal array of how the input system handles the input. IE: Consumed or passed on.

I’m sure that if you manage to take the time to squeeze a ‘&’ in there that your problem will go away.

… thanks C++. If this fixes my issue I will be very thankful and accept your answer tomorrow.

That was definitely an error in my code, so thanks for pointing that out. For whatever reason that did not fix the problem immediately, when I made the change I actually started seeing MORE issues than before (I had the same event firing more than once on the same component, and not on other components). I ended up changing the lines like this to

input_component->BindAction(FName(TEXT("Action1")), IE_Pressed,
     this, &MyClass::Action1Behavior).bConsumeInput = false;

And THAT fixed everything. I’ll accept your answer because I think it was VS debugging throwing a wrench in what should have been happening, the problem you pointed out was likely the only culprit.