AI perception component damage sense half working?

For the most part, AI damage senses seems to be working as expected. However, it’s failing for a particular pawn type in my game and it’s failing in a very strange way.

I make a call to UAISense_Damage::ReportDamageEvent, then the OnTargetPerceptionUpdated delegate fires for the AI controller’s Perception Component as expected, but when I later make a call to GetPerceivedHostileActors on the Perception Component, it returns nothing O_o

I verified that the target is indeed registered as hostile when OnTargetPerceptionUpdated delegate fires. Also worth noting that sight and hearing senses are working perfectly fine for this pawn type. It’s just the damage sense that seems half broken.

Any ideas what could cause this behavior? There’s very little documentation on the AI Perception components :confused:

Gah! Figured it out.

Turns out I shouldn’t be passing in a projectile that gets destroyed on impact as the instigator in UAISense_Damage::ReportDamageEvent, cause this:

void UAIPerceptionComponent::RemoveDeadData() 
{ 
    for (FActorPerceptionContainer::TIterator It(PerceptualData); It; ++It) 
    { 
        if (It- >Value.Target.IsValid() == false) 
        { 
            It.RemoveCurrent(); 
        } 
    } 
}