Unable to AddDynamic on AIPerception Component

Mr.Pathetic
Mon, 23 Sep 2019 23:48:39 +0000
AI

I am trying to get my head around the AI Perception Component in C++. I’m getting the idea, but I’m stuck at adding a dynamic for the OnPerceptionUpdated event. Every bit of code that I have seen does something like this:

AFPSGuard::AFPSGuard()
    {
     	// ...
    	AIPerceptionComponent->OnPerceptionUpdated.AddDynamic(this, &AFPSGuard::OnSenseUpdated);
    }

    void AFPSGuard::OnSenseUpdated(TArray<AActor*> DetectedActors)
    {
          // ...
    }

However, this happens when I do that:

Some solutions I found said that this happens when you don’t use the correct arguments, but every example I have found uses a TArray as the only argument.

I would appreciate any help. I can’t seem to find the problem on my own.

3 posts - 1 participant