Unreal editor crashes on play

After adding the close door delay my unreal editor crashes when I play.
When I remove that part of the code:
if (GetWorld()->GetTimeSeconds() - LastDoorOpenTime > ClosedDoorDelay) {
CloseDoor();
}
I can start it but it will crash to desktop as soon as i enter the collider.
Also the rotation code:
void UOpenDoor::OpenDoor()
{

//set rotation
Owner->SetActorRotation(FRotator(0.0f, OpenAngle, 0.0f));

}
void UOpenDoor::CloseDoor()
{

//set rotation
Owner->SetActorRotation(FRotator(0.0f, 0.f, 0.0f));

}

I am not where to look to figure out why it is happening.

if (GetWorld()->GetTimeSeconds() - LastDoorOpenTime > ClosedDoorDelay)

In the tutorial its DoorCloseDelay.
Make sure that yours matches as i think this might be your problem?

Thank you for the reply. I checked mine and I have it ClosedDoorDelay. It compiled without error. I think I goofed something else and the crash occurs at rotation.

I copied the code from the teachers build and I still get the crash.
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000170
edit: For some reason after the last building it worked.

Has the issue been resolved?

Yes. I reverted back and rebuilt and everything was fine. I must have goofed the spelling of something important.

1 Like

That’ll do it. Can you hit the check mark on you comments to mark the thread as solved? That way people will know it’s ok now.

Glad you got it fixed.

Sure thing. Sorry about that.

Change this code to
if ( ( GetWorld() -> GetTimeSeconds() - LastDoorOpenTime ) > ClosedDoorDelay)

then will not crash anymore

1 Like

Privacy & Terms