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