Engine is Crashing on Trigger

Following the code I have here in OpenDoor.h:


#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "Engine/TriggerVolume.h"
#include "OpenDoor.generated.h"

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class BUILDING_ESCAPE_API UOpenDoor : public UActorComponent
{
	GENERATED_BODY()

public:	
	// Sets default values for this component's properties
	UOpenDoor();

protected:
	// Called when the game starts
	virtual void BeginPlay() override;

	void OpenDoor();

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

private:
	UPROPERTY(VisibleAnywhere)
	float OpenAngle = 90.0f;

	UPROPERTY(EditAnywhere)
		ATriggerVolume* PressurePlate = nullptr;

	UPROPERTY(EditAnywhere)
		AActor* ActorThatOpens = nullptr;
	
};

In OpenDoor.cpp:

// Called every frame
void UOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
	if (PressurePlate && PressurePlate -> IsOverlappingActor(ActorThatOpens)) 
	{
		OpenDoor();
	}

}

The engine is crashing out as soon as I hit the trigger, can anyone see where it may be going wrong? I’ve also set the Trigger on DefaultPawn and this is what crashes it.

On Unreal Engine 4.19 and VS 2019

What does your OpenDoor function look like?

Thanks for the reply Dan, turns out it was User Error as I moved the Begin Play function empty, since been sorted and finished this part of the course now with no other issues

1 Like

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

Privacy & Terms