Hi there.
I have a problem with the detour crowd system. Some time ago i had the problem that on simulate/play the game in editor, the editor crashes randomly while playing when using detour crowd. The error message was missing interface implementation or something. i could fix this by registering the crowd agents in the constructor of the my base character class (bots and player-characters are children of that class) and it works just fine until i upgrade from ue4.21.2 to 4.25.3.
Now, when i am adding a new bot (drag and drop new blueprint from my bot class) to a level and start game/simulate in editor it crashes instandly with a new error message, se below:
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000008
UE4Editor_AIModule!UCrowdManager::UpdateSelectedDebug() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\AIModule\Private\Navigation\CrowdManager.cpp:872]
UE4Editor_AIModule!UCrowdManager::DebugTick() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\AIModule\Private\Navigation\CrowdManager.cpp:1118]
UE4Editor_Engine!FTickableGameObject::TickObjects() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\Engine\Private\Tickable.cpp:151]
UE4Editor_UnrealEd!UEditorEngine::Tick() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Editor\UnrealEd\Private\EditorEngine.cpp:1725]
UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Editor\UnrealEd\Private\UnrealEdEngine.cpp:414]
UE4Editor!FEngineLoop::Tick() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:4850]
UE4Editor!GuardedMain() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\Launch\Private\Launch.cpp:169]
UE4Editor!GuardedMainWrapper() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:137]
UE4Editor!WinMain() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:268]
UE4Editor!__scrt_common_main_seh() [d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll
When i am adding a bot, save and restart the editor it works as expected without a crash. It still looks like that something is not working correctly with agent registration but i can’t find out why.
Like in the description of the detour crowd system by epic i addet the crowd interface to the character class, implement the interface functions like GetCrowdAgentLocation(), GetCrowdAgentVelocity()… in the character class, registering those actors with
UCrowdManager* CrowdManager = UCrowdManager::GetCurrent(this);
if (CrowdManager)
{
ICrowdAgentInterface* MyAgent = Cast<ICrowdAgentInterface>(this);
CrowdManager->RegisterAgent(MyAgent);
}
in the constructor of the character class and change the constructor of my ai controller to
AUE4_AIController::AUE4_AIController(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer.SetDefaultSubobjectClass<UCrowdFollowingComponent>(TEXT("PathFollowingComponent")))
Do i miss something else?
Some more informations:
I testet this on multiple levels, all with the same result.
Unregistering bots/agents by deleting a bot in editor or killing the bot ingame does work without any problems.
I have also tested this with different meshes, humanoids including the original epic mannequin mesh, other humanoid characters and also no humanoid to check if there may be a problem with the mesh/collision/rig itself, but allways the same result.
maybe somebody else has an idea whats going on. thank you very much!