'#OpenDoor.Generated.h' included but not detected

After adding my most recent code to close the door and test it out, the compiler gave me an error message.

…/Unreal Projects/Udemy/BuildingEscape/Source/BuildingEscape/OpenDoor.h(44) : Error: Expected an include at the top of the header: ‘#include “OpenDoor.generated.h”’

However, my OpenDoor.h file contains #include "OpenDoor.generated.h"

I tried adding that to the .cpp file as well, but that didn’t resolve it. How do I resolve this?

My code:

#pragma once

#include "Components/ActorComponent.h"
#include "OpenDoor.generated.h"

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class BUILDINGESCAPE_API UOpenDoor : public UActorComponent

	// Sets default values for this component's properties
	// Called when the game starts
	virtual void BeginPlay() override;
    void OpenDoor();

    void CloseDoor();
    // Called every frame
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

    float OpenAngle = 90.0f;

    ATriggerVolume* PressurePlate;
    float DoorCloseDelay = 1.f;
    float LastDoorOpenTime;
    AActor* ActorThatOpens; // Pawn inherits from actor*
    AActor* Owner; // The owning door

Try deleting the binary and intermediate folders, right clicking the .uproject and generate project files. Then rebuild the solution.

Privacy & Terms