EnhancedInputSubsystem .Player Controller -> GetLocalPlayer(). Cannot resolve symbol 'GetLocalPlayer'.

Hii
I am following a course on Unreal Engine 2d game with c++. The problem i am facing is in the Enhanced Input subsystem part where the tutor’s editor did not show any error while writing the line
“PlayerController->GetLocalPlayer()”
But my editor shows errors as. Cannot resolve symbol ‘GetLocalPlayer’.

tutors code-

My code -


image

You are trying to Cast the player controller to your own Character class, and not an APlayerController:

ACar* PlayerController = Cast<ACar>(Controller);

instead of

APlayerController* PlayerController = Cast<APlayerController>(Controller);

Thus your character class will not have the function ‘GetLocalPlayer’.

1 Like