Unreal crashing after pressing play the first time, but not during the first test

Hi, so I’m currently having an issue where my project keeps crashing after the first time I click play. Currently I have an AI system that simply moves towards the player, built in C++. During this first test, everything goes just as planned, my NPCs move towards and follow the player until they reach a certain radius. However, upon pressing play again, there’s a couple issues that seem to happen randomly.

The first issue is that the engine may simply crash, giving an EXCEPTION_ACCESS_VIOLATION as the cause, with the call stack looking like this:
UnrealEditor_UnrealEd!FPackageBuildDependencyTracker::StaticOnObjectHandleRead() [D:\build++UE5\Sync\Engine\Source\Editor\UnrealEd\Private\Cooker\PackageBuildDependencyTracker.cpp:70]
UnrealEditor_UnrealEd!UE::Core::Private::Function::TFunctionRefCaller<void (__cdecl*)(TArrayView<UObject const * const,int>),void __cdecl(TArrayView<UObject const * const,int>)>::Call() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Public\Templates\Function.h:475]
UnrealEditor_CoreUObject!UE::CoreUObject::Private::OnHandleRead() [D:\build++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ObjectHandleTracking.cpp:153]
UnrealEditor_AIModule!UE::CoreUObject::Private::OnHandleRead() [D:\build++UE5\Sync\Engine\Source\Runtime\CoreUObject\Public\UObject\ObjectHandleTracking.h:110]
UnrealEditor_AIModule!UPathFollowingComponent::HasReached() [D:\build++UE5\Sync\Engine\Source\Runtime\AIModule\Private\Navigation\PathFollowingComponent.cpp:1087]
UnrealEditor_AIModule!UPathFollowingComponent::HasReached() [D:\build++UE5\Sync\Engine\Source\Runtime\AIModule\Private\Navigation\PathFollowingComponent.cpp:1127]
UnrealEditor_AIModule!AAIController::MoveTo() [D:\build++UE5\Sync\Engine\Source\Runtime\AIModule\Private\AIController.cpp:670]
UnrealEditor_AIModule!AAIController::MoveToActor() [D:\build++UE5\Sync\Engine\Source\Runtime\AIModule\Private\AIController.cpp:582]

The call prior to all of this is my StartPlan() function, with the if statement that seems to be causing the issue looking like this:

The other thing that happens sometimes is that I am actually able to start up the project, however the NPCs will no longer follow the player, but will instead simply move to the player’s starting location. During one of these tests, I had a similar output to what would normally be output in Unreal’s crash handler, but instead in Visual Studio:


Triggering this breakpoint:

Clearly, something seems to be going wrong with object handling, however I have no idea what this could be as I’m fairly new to Unreal Engine. I thought it might have something to do with Unreal’s garbage collection, but I messed around with it and it didn’t seem to effect anything. If anyone has any advice it’d be greatly appreciated!

Solved the issue, it was an issue with GetDefaultObjects.

1 Like

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