Hi All,
I’m having some issue to add a function onPerceptionUpdate. Basically I want to run this function with this delegate but the call from another class is not working and I get this error " no instance of function template matches the argument list".
This is the call:
// Fill out your copyright notice in the Description page of Project Settings.
#include "BTService_UpdateAIPerception.h"
#include "Perception/AIPerceptionComponent.h"
#include "OakIsland/Enemy/Enemy_AIController.h"
UBTService_UpdateAIPerception::UBTService_UpdateAIPerception()
{
NodeName = TEXT("Get AI Active Senses");
}
void UBTService_UpdateAIPerception::ReceiveExecuteAIImplementation(AAIController* OwnerController, APawn* ControlledPawn)
{
if (!OwnerController)
{
ReceiveDeactivation(ControlledPawn);
}
AIOwnerController = Cast<AEnemy_AIController>(OwnerController);
GetActiveSenses();
}
void UBTService_UpdateAIPerception::GetActiveSenses()
{
//AIOwnerController->AIPerception->on;
AIOwnerController->AIPerception->OnPerceptionUpdated.AddDynamic(AIOwnerController, &AEnemy_AIController::OnPawnDetected);
}
this is the .h of my controller:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "AIController.h"
#include "Enemy_AIController.generated.h"
class UAIPerceptionComponent;
UCLASS()
class OAKISLAND_API AEnemy_AIController : public AAIController
{
GENERATED_BODY()
public:
//AI Perception
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "AI")
UAIPerceptionComponent* AIPerception;
UPROPERTY()
UBehaviorTree* GetBehaviorTree();
UFUNCTION()
void OnPawnDetected(const TArray<AActor*> UpdatedActors);
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
private:
UPROPERTY(EditAnywhere)
UBehaviorTree* AIBhavior;
};
I have tried a lot of things found in the forum but I really don’t understand what I’m doing wrong. Please help I’m desperate!