UE4 Code Problem S03E065

Hi Guys,

I have really weird problem with my unreal. I was trying to find similar questions to mine, but it seems like I am the first one.
I am using UE 4.14.1 to build my solutions/projects and I am on 65th epizode of Building Escape tutorial, however I have a problem with part of the code from lecture. I am following step by step threw the lectures and I am not able to find solution for this bug. I wrote the same stuff using blueprits and it works perfectly fine.
What is the problem:

The problem is the actual two lines of code above. How I know that? I have commented it out and the game was able to run.

The thing is that code compiles perfectly, just when I hit Play button in UE it crashes the engine with following output:

This is really annoying, even if I will do this thing in Blueprints I have no idea if I will be able to continue the learning.

Another functions:

I am on my holidays now so I will try to answer as fast as I can. Much appreciate for your help.

You forgot to assign the trigger volume in the open door component details tab within Unreal


If you mean that I did assign it, but I did it only for one door not for both of them so I had a crash, which is weird for me.
Thank you for poining me into right direction!

One helpful thing, I’m not sure if it’s idiomatic in Unreal programming, is to protect the code from an invalid configuration, especially when that configuration is done via an environment editing tool like Unreal.

Here’s how I would write the if:

if (PressurePlate && PressurePlate->IsOverlappingActor(ActorThatOpens)) {

before the && will test that PressurePlate is not null. If it is null it prevents the part after the && from being evaluated.

I wrapped a slightly more explicit check…

	if (PressurePlate != nullptr)
{
	if (PressurePlate->IsOverlappingActor(PlayerPawn))
	{
		OpenDoor();
		LastDoorOpenTime = GetWorld()->GetTimeSeconds();
	}
}

Thanks for your replay. What is weird for me that you have to assign both components to the trigger. Simply as that if you didn’t assign trigger to the comonent it shouldn’t open the door, however your solution shows only that you have to do it anyway or if statement wont work. I would uses || operator to avoid assigning both of them.

Thanks for the replay. I didn’t think about wrapping one statement into another. Anyway I don’t think that engine should crash if one of the doors are not assigned. Maybe it is like that because we are doing it in cpp.
Anyway evrything works now. I’ll move forward with tutorial soon so I will be more flexible with the engine on proramming lvl… (I hope)

Privacy & Terms