I need help

Hello. I’m having quite an issue when I got to 111. Getting The Player To Open The Door on Udemy. For whatever reason, I keep getting this error and I have no idea how to get around it. The error mainly occurs when I get to this part:
ActorThatOpens = GetWorld()-GetFirstLocalPlayerController()->GetPawn();

ERROR:

**CODE: **

#include "Engine/World.h"
#include "GameFramework\PlayerController.h"
#include "OpenDoor.h"
#include "GameFrameWork\Actor.h"

// Sets default values for this component's properties
UOpenDoor::UOpenDoor()
{
	// Set this component to be initialized when the game starts, and to be ticked every frame.  You can turn these features
	// off to improve performance if you don't need them.
	PrimaryComponentTick.bCanEverTick = true;

	// ...
}


// Called when the game starts
void UOpenDoor::BeginPlay()
{
	Super::BeginPlay();
	InitialYaw = GetOwner()->GetActorRotation().Yaw;
	CurrentYaw = InitialYaw;
	TargetYaw += InitialYaw;

	if (!PressurePlate)
	{
		UE_LOG(LogTemp, Error, TEXT("%s has the open door componet on it, but no pressureplate set."), *GetOwner()->GetName())
	}

	ActorThatOpens = GetWorld()->GetFirstPlayerController()->GetPawn();
}

The code doesn’t seem to match the error. Are you sure you saved the file? Have you tried restarting the editor and compiling again?

Privacy & Terms