InputComponent BindAction delegate to other object than this

Inside my Pawn’s AMyPawn::SetupPlayerInputComponent I want to BindAction to a delegate function not from AMyPawn, but from AMyPlayerController.

AMyPlayerController* myController = Cast<AMyPlayerController>(this->GetController());

InputComponent->BindAction("Shoot", IE_Pressed, myController, &AMyPlayerController::StartShooting);
InputComponent->BindAction("Shoot", IE_Released, myController, &AMyPlayerController::StopShooting);

This compiles successfully, but does absolutely nothing and doesn’t call the StartShooting and StopShooting functions. What am I doing wrong?
It is working perfectly fine when I place this as the object and delegate a function from AMyPawn

I haven’t had any trouble with this other than you cannot bind the same function to multiple delegates, e.g. you cannot bind “Shoot” to a function in both the controller and pawn.

You could also try using the PlayerController’s SetupInputComponent() function to do the binding and see if that makes any difference.

Well, I refactored a lot of the Controllers code and bypassed this problem, so I guess resolved.

You could have also created a local method that calls the foreign method.