Assertion failed: (Index >= 0) & (Index < ArrayNum) [Link Removed] [Line: 785] Array index out of bounds: 2 from an array of size 2
Source Context:
363 return OwnerController->GetPawn(); 364 } 365 366 return Cast<AActor>(GetOuter()); 367 } 368 369 AActor* UAIPerceptionComponent::GetMutableBodyActor() 370 { 371 return const_cast<AActor*>(GetBodyActor()); 372 } 373 374 void UAIPerceptionComponent::RegisterStimulus(AActor* Source, const FAIStimulus& Stimulus) 375 { 376 FStimulusToProcess& StimulusToProcess = StimuliToProcess[StimuliToProcess.Add(FStimulusToProcess(Source, Stimulus))]; 377 ***** StimulusToProcess.Stimulus.SetExpirationAge(MaxActiveAge[int32(Stimulus.Type)]); 378 } 379 380 void UAIPerceptionComponent::ProcessStimuli() 381 { 382 if(StimuliToProcess.Num() == 0) 383 { 384 UE_VLOG(GetOwner(), LogAIPerception, Warning, TEXT("UAIPerceptionComponent::ProcessStimuli called without any Stimuli to process")); 385 return; 386 } 387 388 const bool bBroadcastEveryTargetUpdate = OnTargetPerceptionUpdated.IsBound(); 389 390 FStimulusToProcess* SourcedStimulus = StimuliToProcess.GetData(); 391 TArray<AActor*> UpdatedActors; 392 UpdatedActors.Reserve(StimuliToProcess.Num());
1. Open the attached project
2. Open New Map
3. PIE
4. Move to the left until you bump the collision
5. Exit PIE
6. Open the AI Controller
7. Select the AI Perception Stimuli Source and check Auto Register As Source
8. Compile & Save
9. PIE
10. Bump into the collision on the left again
Result: Editor crashes
Expected: No crash would occur.
UE4Editor_AIModule!UAIPerceptionComponent::RegisterStimulus() [aiperceptioncomponent.cpp:378] UE4Editor_AIModule!UAISense_Damage::Update() [aisense_damage.cpp:82] UE4Editor_AIModule!UAIPerceptionSystem::Tick() [aiperceptionsystem.cpp:245] UE4Editor_Engine!UWorld::Tick() [leveltick.cpp:1251] UE4Editor_UnrealEd!UEditorEngine::Tick() [editorengine.cpp:1356] UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [unrealedengine.cpp:370] UE4Editor!FEngineLoop::Tick() [launchengineloop.cpp:2644] UE4Editor!GuardedMain() [launch.cpp:142] UE4Editor!GuardedMainWrapper() [launchwindows.cpp:126] UE4Editor!WinMain() [launchwindows.cpp:200] UE4Editor!__scrt_common_main_seh() [exe_common.inl:264] kernel32!<Unknown> ntdll!<Unknown>
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-29939 in the post.