How do I fix error C2039: 'GetPlayerCharactor': is not a member of 'UGameplayStatics'?

I am getting this error when I compile the game:
error C2039: ‘GetPlayerCharactor’: is not a member of ‘UGameplayStatics’

here is the section of code causing the error.

void AMainGameMode::OnSwitch()
{
if (Switched)
{
FVector NewLocation = UGameplayStatics::GetPlayerCharactor(GetWorld(), 0)->GetActorLocation();
NewLocation.X = 1200.0f
UGameplayStatics::GetPlayerCharactor(GetWorld(), 0)->SetActorLocation(NewLocation);
}
else
{
FVector NewLocation = UGameplayStatics::GetPlayerCharactor(GetWorld(), 0)->GetActorLocation();
NewLocation.X = 200.0f
UGameplayStatics::GetPlayerCharactor(GetWorld(), 0)->SetActorLocation(NewLocation);
}

Switched = !Switched;

}

Well, the compiler never lies. There indeed is no GetPlayerCharactor function in UGameplayStatics. There’s GetPlayerCharacter :slight_smile: Next time I suggest checking for misspellings first. Happens to the best of us on a regular basis :smiley:

Cheers,

–mieszko