Make AIPerception ignore a certain actor

Hello, so i have a UAIPerceptionComponent that detects “hostile” actors using the team perception and attacks them. When an character is killed, i want all remaining actors to ignore him. How can i acomplish that? I tryed changing the “dead” actor’s team to be “neutral” but it doesen’t seem to have any effect at all. Maybe i have to force an update for the Perception? Can i do that? Is there any other better way to do this?

Or you can add variable bIsDying to your characters, and other character will check it before perform attacks.

This is the way i wanted to do it, but i created this post in hope that i would get a better answer. Casting to that character and cheking the value adds up a lot of extra code (i use “GetCurrentlyPercivedActors” in muliple places for a lot of checks and perception updates) and this would reduces performance by a little bit… Thanks anyway.

But you will have some dying/death state in character anyway.
And you should check it before attack. The same as you should check some other states, like “stun”, for example.

Found the perfect way to clear it from the perception: i just added this to the “die” function. I think it is ok performancewise for a few (<10) actors.

        TArray<AActor*> FoundActors;
        UGameplayStatics::GetAllActorsOfClass(this, APirateController::StaticClass(), FoundActors);
        for (AActor* CurrentActor : FoundActors) {