I’m just following some online tutorials on setting up some basic AI system and I’m trying to create a BehaviourTreeComponent in C++. But whenever I try to create it in my Ai Controller constructor it just won’t compile. the errors I’m seeing on Visual Studios are Error LNK1104 and System.UnauthorizedAccessException. I haven’t no idea why it’s doing that because whenever I comment it out, it compiles correctly and it runs. What exactly is wrong with it? Is it something to do with me? Or is it the Engine itself that’s a bit buggy?
Here’s the code I have:
Header
/**
*
*/
UCLASS()
class ATigerController : public AAIController
{
GENERATED_UCLASS_BODY()
UPROPERTY(transient)
TSubobjectPtr<class UBlackboardComponent> BlackboardComp;
UPROPERTY(transient)
TSubobjectPtr<class UBehaviorTreeComponent> BehaviorComp;
virtual void Possess(class APawn* InPawn) OVERRIDE;
virtual void BeginInactiveState() OVERRIDE;
};
CPP
ATigerController::ATigerController(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
BlackboardComp = PCIP.CreateDefaultSubobject<UBlackboardComponent>(this, TEXT("BlackBoardComp"));
BehaviorComp = PCIP.CreateDefaultSubobject<UBehaviorTreeComponent>(this, TEXT("BehaviorComp"));
bWantsPlayerState = true;
PrimaryActorTick.bCanEverTick = true;
}
void ATigerController::Possess(APawn* InPawn)
{
Super::Possess(InPawn);
}
void ATigerController::BeginInactiveState()
{
Super::BeginInactiveState();
}
Any help on this would be greatly appreciated.
thanks