As always… I keep doing silly mistakes myself. For some reason I had started behavior tree two times with different functions:
BT_Component->StartTree(*Character->BehaviorTreeAsset);
RunBehaviorTree(Character->BehaviorTreeAsset);
As UBehaviorTreeComponent’s function StartTree checks whether tree isn’t already running, it starts the tree
void UBehaviorTreeComponent::StartTree(UBehaviorTree& Asset, EBTExecutionMode::Type ExecuteMode /*= EBTExecutionMode::Looped*/)
{
// clear instance stack, start should always run new tree from root
UBehaviorTree* CurrentRoot = GetRootTree();
if (CurrentRoot == &Asset && TreeHasBeenStarted())
{
UE_VLOG(GetOwner(), LogBehaviorTree, Log, TEXT("Skipping behavior start request - it's already running"));
return;
}
// irrelevant at the moment
As AAIController's function RunBehaviorTree doesn't check that, behavior tree will run behavior tree once more, which makes me question which of these functions should I use to initalize the behaviortree.
Waiting for your response!
With regards!