I have a AI controller with a blackboard component. The class is written in c++. I made a blueprint out of the class and when I open the components present in the blueprint class, the editor crashes with the error
Transient property ObjectProperty /Script/AITest.MyAIController:BlackboardComp contains a reference to non-transient subobject BlackboardComp.
Here is the code
.h
UCLASS()
class AITEST_API AMyAIController : public AAIController
{
GENERATED_UCLASS_BODY()
UPROPERTY(Transient)
TSubobjectPtr<class UBlackboardComponent> BlackboardComp;
UPROPERTY(Transient)
TSubobjectPtr<class UBehaviorTreeComponent> BehaviourComp;
/** Posses The character */
virtual void Possess(class APawn* InPawn) override;
/* Bot Runs like crazy*/
UFUNCTION(BlueprintCallable, Category = Behavior)
void RunCrazy();
};
.cpp
#include "AITest.h"
#include "BehaviorTree/BehaviorTree.h"
#include "BehaviorTree/BehaviorTreeComponent.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "MyBotCharacter.h"
#include "MyAIController.h"
AMyAIController::AMyAIController(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
BlackboardComp = PCIP.CreateDefaultSubobject<UBlackboardComponent>(this, TEXT("BlackBoardComp"));
BehaviourComp = PCIP.CreateDefaultSubobject<UBehaviorTreeComponent>(this, TEXT("BehaviourComp"));
}
void AMyAIController::Possess(APawn* InPawn)
{
Super::Possess(InPawn);
AMyBotCharacter* Bot = Cast<AMyBotCharacter>(InPawn);
// start behavior
if (Bot && Bot->BotBehavior)
{
BlackboardComp->InitializeBlackboard(Bot->BotBehavior->BlackboardAsset);
}
}
void AMyAIController::RunCrazy()
{
GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Red, "Activated");
}
The whole error message
link text