OnPerceptionUpdated.AddDynamic doesn't work

Hi,

i’m trying to delegate OnPerceptionUpdated to my custom function and am not able to use the AddDynamic makro.

MyAIController.h

UPROPERTY(VisibleAnywhere, Category = "MyAIController|Perception")
class UAIPerceptionComponent* PercComp;

UPROPERTY(EditDefaultsOnly, Category = "MyAIController|Perception")
class UAISenseConfig_Sight* SightCfgComp;

UFUNCTION()
		void ProcessPerceivedInformation(TArray<AActor*> UpdatedActors);

MyAIController.cpp

AMyAIController::AMyAIController(const FObjectInitializer& ObjectInitializer)
	:Super(ObjectInitializer)
{
	PercComp = ObjectInitializer.CreateDefaultSubobject<UAIPerceptionComponent>(this, TEXT("MyPercComp"));
	SightCfgComp = ObjectInitializer.CreateDefaultSubobject<UAISenseConfig_Sight>(this, TEXT("MySightCfgComp"));

	if (PercComp && SightCfgComp) {
		PercComp->ConfigureSense(*SightCfgComp);
		PercComp->SetDominantSense(SightCfgComp->GetSenseImplementation());

		SightCfgComp->SightRadius = 2000.0f;
		SightCfgComp->LoseSightRadius = 2200.0f;
		SightCfgComp->PeripheralVisionAngleDegrees = 90.0f;

		SightCfgComp->DetectionByAffiliation.bDetectEnemies = true;
		SightCfgComp->DetectionByAffiliation.bDetectFriendlies = true;
		SightCfgComp->DetectionByAffiliation.bDetectNeutrals = true;
	}

	GetPercComp()->OnPerceptionUpdated.AddDynamic(this, &AMyAIController::ProcessPerceivedInformation);
}


void AMyAIController::ProcessPerceivedInformation(TArray<AActor*> UpdatedActors) {
	
}

Does anyone spot my error ?

Lol. I thought i tried it already that way. Obviously i was wrong.
Thank you DarkwindRichard and Epic !

Hi 5v29n,

The OnPerceptionUpdated event takes a const reference to an array of actors ( const TArray<AActor*>& ), whereas your code is simply an array. If you change the parameter that should fix your compile error.