I’m playing around with the perception system and noticed that an AI will detect a Pawn with Sight via the perception system even though the Pawn has no Perception Stimulus Source?
Steps to re-create from the First Person Template:
Create an AI Controller Blueprint
Add an AIPerception Component to the AI Controller
Add an AI Sight Config to the AIPerception and set Detect Enemies, Detect Friendlies and Detect Neutrals to true
Bind the event “OnTargetPerceptionUpdated” for the AIPerception Component and print a string when it’s called
Create a dummy Pawn and add it to the level
Set the dummy pawns’ AI controller class to the one you just made
Run the game and walk in front of the AI and the “OnTargetPerceptionUpdated” will be called even though the First Person Character/Controller has no AIPerceptionStimuliSource component
This is actually intended behavior. By default Pawns are registered as stimuli sources. You can disable this per sense using the config variable AISense.bAutoRegisterAllPawnsAsSources.
However, there’s no way to do this via the editor at the moment.
Did this change? I tried adding it, even in different config files and it’s still detecting unregistered pawns. I also checked inside AISense_Sight and i can’t find this property, was it removed?
Cheers
Edit: i found that bAutoRegisterNewPawnsAsSources is defined in AISense, the base class of sight. But still, it dosen’t seems like the line i added in DefaultEngine.ini changed anything.
I tried moving it to DefaultGame.ini but my pawn is still detected. I tried recompiling but still nothing. Is there something special to do for config files to be loaded in?
Ah finaly found my problem, thanks to you, it’s “bAutoRegisterAllPawnsAsSources=false” instead of “bAutoRegisterNewPawnsAsSources=false”. They changed it. I’ll add a new answer for the next souls to come around here.