UE4 Editor OnPlay Crash :(

the crash is cause by this code

if (pressurePlate->IsOverlappingActor(actorTriggered)) {
	OpenDoorOnTrigger();
}

not sure why…

-UE4 version 4.14
-UE4 LOG ERROR-

Access violation - code c0000005 (first/second chance not available)

UE4Editor_Engine!AActor::IsOverlappingActor() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\engine\private\actor.cpp:1196]
UE4Editor_EscapeRoom!UOpenDoor::TickComponent() [d:\workstation\ue4_projects\escaperoom\source\escaperoom\opendoor.cpp:41]
UE4Editor_Engine!FActorComponentTickFunction::ExecuteTickHelper<<lambda_813da28c01a0b9c538759539d0a87b8d> >() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\engine\classes\gameframework\actor.h:2950]
UE4Editor_Engine!FActorComponentTickFunction::ExecuteTick() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\engine\private\components\actorcomponent.cpp:741]
UE4Editor_Engine!FTickFunctionTask::DoTask() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\engine\private\ticktaskmanager.cpp:256]
UE4Editor_Engine!TGraphTask<FTickFunctionTask>::ExecuteTask() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\core\public\async\taskgraphinterfaces.h:868]
UE4Editor_Core!FNamedTaskThread::ProcessTasksNamedThread() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\core\private\async\taskgraph.cpp:932]
UE4Editor_Core!FNamedTaskThread::ProcessTasksUntilIdle() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\core\private\async\taskgraph.cpp:694]
UE4Editor_Engine!FTickTaskSequencer::ReleaseTickGroup() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\engine\private\ticktaskmanager.cpp:542]
UE4Editor_Engine!FTickTaskManager::RunTickGroup() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\engine\private\ticktaskmanager.cpp:1437]
UE4Editor_Engine!UWorld::RunTickGroup() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\engine\private\leveltick.cpp:730]
UE4Editor_Engine!UWorld::Tick() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\engine\private\leveltick.cpp:1351]
UE4Editor_UnrealEd!UEditorEngine::Tick() [d:\build\++ue4+release-4.14+compile\sync\engine\source\editor\unrealed\private\editorengine.cpp:1422]
UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [d:\build\++ue4+release-4.14+compile\sync\engine\source\editor\unrealed\private\unrealedengine.cpp:371]
UE4Editor!FEngineLoop::Tick() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\launch\private\launchengineloop.cpp:2859]
UE4Editor!GuardedMain() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\launch\private\launch.cpp:152]
UE4Editor!GuardedMainWrapper() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor!WinMain() [d:\build\++ue4+release-4.14+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:202]
UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:264]
kernel32
ntdll

Yeah I am having the same issue, very very frustrating.

I am assuming it’s because the ActorThatOpens isn’t feeding a pawn in to the if statement. But I don’t know how to fix that because well I am new.

OpenDoor.cpp

// Called when the game starts
void UOpenDoor::BeginPlay()
{
Super::BeginPlay();

ActorThatOpens = GetWorld()->GetFirstPlayerController()->GetPawn();
}

void UOpenDoor::OpenDoor()
{
// find owner
AActor* Owner = GetOwner();

// create rotator
FRotator NewRotation = FRotator(0.0f, 60.0f, 0.0f);

// set rotation
Owner->SetActorRotation(NewRotation);
}

// Called every frame
void UOpenDoor::TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction )
{
Super::TickComponent( DeltaTime, TickType, ThisTickFunction );

// Poll the trigger volume
if (PressurePlate->IsOverlappingActor(ActorThatOpens))
{
OpenDoor();
}
}

OpenDoor.h

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

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

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

void OpenDoor();

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

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

UPROPERTY(EditAnywhere)
ATriggerVolume* PressurePlate;

AActor* ActorThatOpens; //remember pawen inherits from actor
};

I ended up trying to debug it, I added this to BeginPlay to see what the name of the pawn is:

FString ObjectPos = GetWorld()->GetFirstPlayerController()->GetPawn()->GetName();
UE_LOG(LogTemp, Warning, TEXT(“Actor name is %s”), *ObjectPos);

I added this to TickComponent, and it returned that yes the pawn isn’t null

if(ActorThatOpens != nullptr)
{
UE_LOG(LogTemp, Warning, TEXT(“Player has a pawn”));
}

So it seems it’s getting a pawn and it’s name etc, so why the hell isn’t this line working:

ActorThatOpens = GetWorld()->GetFirstPlayerController()->GetPawn();

I tried various different if statements to figure it all out and I am absolutely stuck and I can’t continue.

So it seems the solution to this crash is:

if (PressurePlate)
{
if (PressurePlate->IsOverlappingActor(ActorThatOpens))
{
OpenDoor();
}
}

After 2 hours of bashing my head against this stuff I guess I am done for the day.

1 Like

So it seems the solution to this crash is:

if (PressurePlate)
{
if (PressurePlate->IsOverlappingActor(ActorThatOpens))
{
OpenDoor();
}
}
After 2 hours of bashing my head against this stuff I guess I am done for the day.

Quite useful Garth_Hendy. Thanks

1 Like

I also encountered the same problem and after an hour checked here, so glad I did! Thanks Garth!

wierd is it calling tick before begin play? thx for solution about to try it

or wait i guess that would mean tick is called before it sets up the trigger reference default?

ohhh its because I had doors in the world with no reference set haha wow.

which for some reason it reset the setting on the one door that was set (to none). Maybe because i renamed the ATriggerVolume* variable before next compile

Privacy & Terms