Download

AIPerceptionComponent don't call OnTargetPerceptionUpdated when Player spawn inside AISight area.

Hi, I write AI for my mobs and I have some problems with behavior of my mobs. AIPerceptionComponent don’t call OnTargetPerceptionUpdated when PlayerCharacter spawn in AISight area after BeginPlay. OnTargetPerceptionUpdated calls only if PlayerCharacter pass through border of mob’s AISight.
Please write if you know why it happens or if it’s normal behavior.
This is code of my AIController and video:

I think it’s by design, and you can always request an update:

UAIPerceptionComponent::RequestStimuliListenerUpdate](UAIPerceptionComponent::RequestStimuliListenerUpdate | Unreal Engine Documentation)

I found solution.
this->AIPerceptionComponent->OnTargetPerceptionUpdated.AddDynamic(this, &AEnemyAIController::TargetPerceptionUpdate); bind too late.
At that point OnTargetPerceptionUpdated.Broadcast() in AIPerceptionComponent has already occurred.
I moved it to constructor and it’s working.