Hello,
I’m trying to use run dynamic behavior but it is always none no matter what I do. Even if I set default behavior asset it shows as none. I was debugging the code and all seems to set up properly
header:
UPROPERTY(EditDefaultsOnly, Category="AIStateBehavior")
TMap<EAI_TaskType, UBehaviorTree*> AIStateBehaviours;
cpp
void ABaseAIController::BeginPlay()
{
if (BehaviorTree != nullptr)
{
RunBehaviorTree(BehaviorTree);
}
BTComp = Cast<UBehaviorTreeComponent>(BrainComponent);
DynamicBTGameplayTag = FGameplayTag::RequestGameplayTag(FName("BT.Task"));
}
void ABaseAIController::SetTaskBehavior()
{
UBehaviorTree* DynamicBT = AIStateBehaviours.FindRef(CurrentTaskType);
if (DynamicBT != nullptr && BTComp != nullptr && DynamicBTGameplayTag != DynamicBTGameplayTag.EmptyTag)
{
BTComp->SetDynamicSubtree(DynamicBTGameplayTag, TestBT);
}
}
BT:
Controller: