RealDocs

AAIController::PerceptionComponent

property AIModule Since 4.0
#include "AIController.h"
Access: public Specifiers: UPROPERTYVisibleDefaultsOnly

Description

The perception component that feeds sensory data (sight, hearing, damage) to this controller. Add sense configs to this component to make the AI aware of environmental stimuli.

Caveats & Gotchas

  • VisibleDefaultsOnly means the property is visible in the Details panel but cannot be reassigned from Blueprint or the editor at runtime. Use SetPerceptionComponent from C++ if you need to replace it.
  • The component must have at least one sense configured (e.g., UAISenseConfig_Sight) otherwise it registers no stimuli and OnTargetPerceptionUpdated will never fire — a common source of AI that doesn't react to anything.

Signature

TObjectPtr<UAIPerceptionComponent> PerceptionComponent

Example

Bind a perception updated delegate in BeginPlay C++
void AMyAIController::BeginPlay()
{
	Super::BeginPlay();
	if (PerceptionComponent)
	{
		PerceptionComponent->OnTargetPerceptionUpdated.AddDynamic(
			this, &AMyAIController::OnPerceptionUpdated);
	}
}

Tags

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.