To register an actor as a stimulus source, you can either use the AIPerceptionStimuliSource component, or manually call functions in the perception system:
UAIPerceptionSystem* PerceptionSystem = UAIPerceptionSystem::GetCurrent(GetWorld());
PerceptionSystem->RegisterSourceForSenseClass(UAISense_Sight::StaticClass(), *this);
Note that although RegisterSense
allows you to register for all senses, it doesn’t work correctly if the perception system hasn’t yet initialized its senses list which can happen if no sense has been explicitly registered yet.