Is there any difference between APawn::EnableInput and APlayerController::EnableInput? Their descriptions in UE documentation are quite similar, so why do we call GetPawn() inside the APlayerController class?
They do the exact same thing.
APlayerController:
void APlayerController::EnableInput(class APlayerController* PlayerController)
{
if (PlayerController == this || PlayerController == NULL)
{
bInputEnabled = true;
}
else
{
UE_LOG(LogPlayerController, Error, TEXT("EnableInput can only be specified on a PlayerController for itself"));
}
}
APawn:
void APawn::EnableInput(class APlayerController* PlayerController)
{
if (PlayerController == Controller || PlayerController == nullptr)
{
bInputEnabled = true;
}
else
{
UE_LOG(LogPawn, Error, TEXT("EnableInput can only be specified on a Pawn for its Controller"));
}
}
So within the PlayerController class you could just write
EnableInput(this);
I’ve tried to write just
EnableInput(this);
but it didn’t work. I suppose it depends on input binding. As we binded input to the Tank (Pawn), we can enable or disable it only there.
Thank You for the answer!
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.