Is there some way to disable AI Perception at runtime?

Hi, I just recently made the switch from Pawn Sensing to AI Perception for my enemy AI. In Pawn sensing, there was a way to disable the sensing at runtime, but I’m unable to do the same with AI Perception. I’ve tried disabling it with ‘Set Component Tick Enabled’, but it still registering stimulus using it’s hearing sense. I’d like to turn it off during certain situations like say, when a bot is stunned or incapacitated temporarily, for performance reasons. Is there some way to turn it off natively using the perception and not rely on external conditions to check the bot state every time?

I’m also facing the exact same issue, i think that’s a bug with AIperception that cause it to ignore set component tick enabled even if it is set to false.

Hi, I have the same issue in UE 4.10, SetComponentTickEnabled and Deactivate don’t disable the senses. Is there another way to do this?

This may be a little late but it is a work around that you may be able to try…when you want to temporarily disable the sense you can set their ranges to something really low or to zero or completely turn them off by setting the bool values for each. Like this:

83382-pawnsensing.png

Hi Black Phoenyx

Thank fo the input, but im not sure this will work with AI Perception.

Would you mind posting a screenshot of your setup with Perception Update? Have you tried maybe setting up a simple Bool and branch:

83493-updateperceptionbool.png

I will be happy to, but im not able to do so for the next few weeks.
Maybe Stormrage256 can get something up here faster.

Unfortunately you can’t access via blueprints…but there is a function in code called “UpdatePerceptionWhitelist” on the Perception Component that’ll get this done.

Did you try SetSenseEnabled Function?

PerceptionComp->SetSenseEnabled(UAISense_Sight::StaticClass(), false);
PerceptionComp->SetSenseEnabled(UAISense_Hearing::StaticClass(), false);

It is also exposed to BP:

4 Likes

SetSenceEnabled would indeed work after UE 4.18 when it was added

1 Like