I’m just trying to setup and initialize UBehaviourTreeComponent in C++, but it keeps giving me errors when I compile it. What exactly is wrong with it? Here’s the code I have:
header
#pragma once
#include "GameFramework/AIController.h"
#include "TigerController.generated.h"
/**
*
*/
UCLASS()
class ATigerController : public AAIController
{
GENERATED_UCLASS_BODY()
UPROPERTY(transient)
TSubobjectPtr<class UBlackboardComponent> BlackboardComponent;
UPROPERTY(transient)
TSubobjectPtr<class UBehaviourTreeComponent> BehaviourTreeComp;
virtual void Possess(class APawn* InPawn) OVERRIDE;
};
cpp
#include "Rawr.h"
#include "TigerController.h"
ATigerController::ATigerController(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
BlackboardComponent = PCIP.CreateDefaultSubobject<UBlackboardComponent>(this, TEXT("BlackboardComponent"));
BehaviourTreeComp = PCIP.CreateDefaultSubobject<UBehaviorTreeComponent>(this, TEXT("BehaviourTreeComponent"));
}
void ATigerController::Possess(class APawn* InPawn)
{
Super::Possess(InPawn);
}