Download

[AI] OnTargetPerceptionUpdate is being called with an invalid Actor

Overview: Sight and Hearing works fine but the parameters for PerceptionUpdated are sometimes completely invalid.

I have a bit of strange problem with the callback setup by OnTargetPerceptionUpdated.AddDynamic

PerceptionComponent->OnTargetPerceptionUpdated.AddDynamic(this, &AAICharacterControllerBase::OnPawnSenseInterrupt);

The function OnPawnSenseInterrupt looks like this:

OnPawnSenseInterrupt(AActor Actor, FAIStimulus Stimulus)*

I am finding the Actor paramater is a valid pointer but fails IsValidLowLevel checks. This is usually paired with a Stimulus object that is sometimes sensed successfully and other times not.

Using *IsValidLowLevelFast *sometimes crashes. I don’t have much confidence with using IsValidLowLevel…

Inspecting the parameters in the debugger it’s clear Actor and Stimulus are not correctly initialized.

A little frustrating to debug so hoping this rings a bell to someone.