AI Perception System uses UAISenseConfig objects to configure each sense.

In order to create the sense config in C++, you need to use CreateDefaultSubobject:

//The below code should be in your class' constructor
 
//Create the config object
UAISenseConfig_Sight* SenseConfig = CreateDefaultSubobject<UAISenseConfig_Sight>("SenseConfig_Sight");
 
//Set default values
SenseConfig->SightRadius = 300;
SenseConfig->LoseSightRadius = 300;
SenseConfig->PeripheralVisionAngleDegrees = 22.5;
SenseConfig->DetectionByAffiliation.bDetectEnemies = true;
SenseConfig->DetectionByAffiliation.bDetectNeutrals = true;
SenseConfig->DetectionByAffiliation.bDetectFriendlies = true;
 
//Tell the perception comp to use the config object
PerceptionComponent->ConfigureSense(*SenseConfig);