Hi I have a following Case
There are three AI candidates. In team one there is one AI and in team 2 there are two AI candidates. Initially AI of team 1 senses both AI of team 2 using OnPerceptionUpdated after AI of Team 1 kills one of the AI of Team2 then on printing I get name of AI who got dead in other words I am not getting AI who is still in the sight instead I get the AI who was killed and destroyed.Following is my sample code.
void AAIController::BeginPlay()
{
Super::BeginPlay();
//Function that will be called When Perception Updates
AIPerception->OnPerceptionUpdated.AddDynamic(this, &AIController::SenseAllActors);
}
void AAIController::SenseAllActors(const TArray<AActor*>& detectedActors)
{
for (auto act : detectedActors)
UE_LOG(LogTemp, Warning, TEXT("I %s detected %s"), *GetPawn()->GetName(), *act->GetName());
}