What does AI Perception's Updated Actors encompass?

I am having some difficulty understanding OnPerceptionUpdated behaviour. This is my setup:

In the AI_Controller:

87132-ai_perception_comp_settings.jpg

87133-ai_controller.jpg

In the detectable actors parent class:

87134-ai_stimuli_src.jpg

I do some filtering on the possible targets for now and update a behaviour tree. The detection is working fine except that the enemies never lose sight of the target, no matter how far away or hidden he is. That’s because OnPerceptionUpdated only adds new actors to the “UpdatedActors” but doesn’t remove them when not sensed. I don’t use other senses, or sense components, or modify “PossibleTargets” variable in any other way. I managed to get the behaviour I wanted with this:

What am I doing wrong? Also, how can I set a certain actor’s affiliation (enemy, neutral…) and can I change this during runtime?

This array is a memory footprint of perception component’s sensors. There are all valid targets (are not forgotten) in this array. Targets were determined by diplomacy and were placed to PerceptualData as stimuli (PerceptualData contains valid targets and invalid but returns only valid). OnPerceptionUpdated is a callback for changes of the PerceptualData.
See my answer about diplomacy options:

Thank you for the detailed answer! I hope you recited that from memory and I didn’t make you dig through source code I should have dug myself. Just to make sure, when you say “There are all valid targets” you mean that they were all perceived once and have not been forgotten due to age or destroyed. But they could be out of sight.

Targets in this array may be beyond the detection range from the current position. Max Age parameter of the sense may be useful in this case.

i am still trying to understand this memory array. at first i thought it was an array with the latest actors, then realized it kept old results and whenever i filtered it, it kept giving me old detections. so my question is, how do i reset that array? tried a requestSimuliUpdate but it seems to do nothing. do. i have to cache the results and work with it? managing it by myself? sounds too messy on the long run.

This memory is cache that contains all stimuli that were not forgotten during MaxAge interval (MaxAge = 0 is infinite interval). Stimuli may be beyond the detection range with respect to the current position of the unit. The data in this cache asynchronously updated and can not be updated simultaneously in any way.

forgot about the age, dumb me… thanks for the help