Hello.
I’ve read similar posts here and here and I still can’t get my AI program to link. It flags linking errors on all functions of the AAIController class, even though I added the AIController header. I’ve inverted the order of headers but to no avail. It there an additional project to compile or a module to flag before compiling the base UE4 project ?
I’ve updated to the latest source [4.3.1] from GitHub. Here’s my tentative combination of all I have read so far (based from old tutorials from Mike Purvis and Chad Reddick).
Cheers.
// TutorialController.h
#pragma once
#include "AIController.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "BehaviorTree/BehaviorTreeComponent.h"
#include "BehaviorTree/BehaviorTree.h"
#include "TutorialController.generated.h"
/**
*
*/
UCLASS()
class TUTORIALCHARGED_API ATutorialController : public AAIController
{
GENERATED_UCLASS_BODY()
UPROPERTY(transient)
TSubobjectPtr<class UBlackboardComponent> BlackboardComp;
UPROPERTY(transient)
TSubobjectPtr<class UBehaviorTreeComponent> BehaviorComp;
virtual void Possess(class APawn *InPawn) override;
void SetEnemy(class APawn *InPawn);
UFUNCTION(BlueprintCallable, Category = Behavior)
void SearchForEnemy();
protected:
uint8 EnemyKeyID;
uint8 EnemyLocationID;
};
#include "TutorialCharged.h"
#include "TutorialController.h"
ATutorialController::ATutorialController(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
BlackboardComp = PCIP.CreateDefaultSubobject<UBlackboardComponent>(this, TEXT("BlackboardComp"));
// Components.Add(BlackboardComp); // I had to comment this because it created problems of its own.
BehaviorComp = PCIP.CreateDefaultSubobject<UBehaviorTreeComponent>(this, TEXT("BehaviorComp"));
// Components.Add(BehaviorComp); // ditto.
bWantsPlayerState = true;
PrimaryActorTick.bCanEverTick = true;
}
void ATutorialController::Possess(class APawn *InPawn)
{
// Nothing yet
}
void ATutorialController::SetEnemy(class APawn *InPawn)
{
// Nothing yet
}
void ATutorialController::SearchForEnemy()
{
// Nothing yet
}