EnhancedInput BindAction to call a function from another class

Hello,

I have a custom APlayerController class APC_Base and a custom ACharacter class AC_Base. I’m currently wanting to bind the actions for moving the character in the playercontroller class instead of the character class which has the Move function. I’m a bit confused on what is the best way to achieve this in C++. Here is my code.

PlayerCharacter->InputComponent->BindAction(InputActions->MoveInputAction, ETriggerEvent::Triggered, PlayerCharacter, &AC_Base::Move);

I know the easier way is to just bind it in the character class or to create a function in the player controller class that calls the Move function in my character but I want to know if there is way I can just pass in the Character class’s Move function as parameter for the BindAction

Anyone?

Solved this. Well, it turns out that I forgot to cast the InputComponent to EnhancedInputComponent before I called the BindAction. After making that change, the compiler doesn’t complain about anything.

NOTE: Make sure your pointer to the object from which you’re calling the fuction is not null. In my case, I’m doing the binding in PlayerController class but I’m calling the function on my character. So I’ve to make sure my character is loaded and ready before I try to bind its function.

Hope this helps.