C++ input binding not working in C++, but calls blueprint function

I created a binding using the enhanced inputs.

...
const FName FunctionName = *FString::Printf(TEXT("Project_%s"), *Mapping.Action->GetName());

EnhancedComponent->BindAction(Mapping.Action, ETriggerEvent::Triggered, Cast<UObject>(this), FunctionName);
...
void AProjectCharacter::Project_MoveForward(const FInputActionValue& Value)
{
	printFString("Forward Value : %f", Value.GetMagnitude());
...

It will not do anything that I put into that moveforward. However, just for kicks I created a function on this character in blueprint named Project_MoveForward it calls that properly.

Am I just binding it incorrectly?

Hi ExanlmlsTempus,

Do you get a compiler error if you just put “this” instead of “Cast(this)”?

I do get a compilation error if I do that.

However, I found the issue. I didn’t make the “Project_MoveForward” a UFUNCTION(). I was blind to it after working on it for so long I guess.

Thanks for the help though!

1 Like