Failed to compile



My code was exactly like the code in the lecture, but it fail to compile. In message log it says I had two bugs on the line:
ActorThatOpens = GetWorld()->GetFirstPlayerController()->GetPawn();

I looked up the ue4 docs (https://docs.unrealengine.com/en-US/API/Runtime/Engine/Engine/UWorld/GetFirstLocalPlayerFromControlle-/1/index.html). It says GetFirstPlayerController() returns a pointer to Object ULocalPointer. And when I tracked down docs of ULocalPointer, there is no function called GetPawn(). I wonder how to fix it.

Any suggestions would help.

This is not what you wrote in your code. Take a closer look at your screenshot.

Thank You so much! I’ll be careful about the details next time.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms