I created SM_Door in my Editor with a custom Actor class named "Door" to fire some events like open and close.
The problem is, when I open the UE4 Editor, it loads nearly to 75% loading and then crashes, and I really don't know why!
The code of the Door Header file is:
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "GameFramework/Actor.h"
#include "Door.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class MAZE_API UDoor : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UDoor();
void Open();
void Close();
bool IsOverlapping(AActor*);
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
};
Then I created Runner class representing the default player:
The full code of the Runner class is:
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "Engine/World.h"
#include "Door.h"
#include "GameFramework/Actor.h"
#include "Runner.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class MAZE_API URunner : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
URunner();
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
void IsNearToDoor();
void IsNearToLampKey();
private:
void SetupComponents();
UDoor Door;
AActor* Runner = nullptr;
};

