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
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UOpenDoor();
// 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;
private:
UPROPERTY(VisibleAnywhere)
float OpenAngle = 90.0f;
UPROPERTY(EditAnywhere)
ATriggerVolume* PressurePlate;
UPROPERTY(EditAnywhere)
float DoorCloseDelay = 1.f;
float LastDoorOpenTime;
//UPROPERTY(EditAnywhere)
AActor* ActorThatOpens; // Pawn inherits from actor*
AActor* Owner; // The owning door
};