Keep getting a runtime error everytime I hit the pressure plate and unreal crashes

Hey was just going through the lecture and everytime that I step on the pressure plate with the possessed actor that has been put in the “Actor That Opens” UPROPERTY it crashes and I see the door swing open. Here is my if statement and opendoor.h specifier of the “PawnThatOpens”
.cpp

if (PressurePlate && PressurePlate->IsOverlappingActor(PawnThatOpens)) {
	OpenDoor();
}	

.h

UPROPERTY(EditAnywhere)
APawn* PawnThatOpens;

some help would be great thanks

I have just moved the trigger volume into the corner where the new spotlight is (Lecture 76) and I now get the editor crashing as well. This occurs as soon as I enter the trigger volume when I play the game.

I haven’t solved the problem yet.

I am using AActor rather than APawn.

If I add a new triggervolume and attach that to a door, then “walk” to this volume, then that also crashes the editor.

If I add an additional triggervolume but do not attach it to a door, and play the game and walk through it, then it does not crash. Also, if I unassociate the original problematic triggervolume from the first door, it no longer crashes when I walk through that trigger.

UE version 4.19

I had a look at the GitHub source code for this project and noticed the following line, change just this, and it seems to have stopped the crashing.

UPROPERTY(EditAnywhere)

ATriggerVolume* PressurePlate = nullptr;

Source here:

Well it turned out there was more crashes awaiting for me, and I think now resolved, fingers crossed.

I ended up with
Owner = GetOwner();
in the cpp file BeginPlay area

as well as:
AActor* ActorThatOpens = nullptr; // Remember pawn inherits from actor
AActor* Owner = nullptr;

in the header file, some code may be important, others not, I will leave that to you.

Privacy & Terms