Blackboard inheritance on dynamic subtrees (4.26)

I also ran into this issue and it has taken me a day, the result is very frustrating. I found this in the source code for “Run Behavior”
BTTask_RunBehavior.cpp

bIsBBCompatible = BlackboardData == OtherBlackboardData || BlackboardData->IsChildOf(*OtherBlackboardData);

Where BlackboardData is the blackboard of the main behavior tree and OtherBlackboardData is the blackboard of the sub behavior tree. From this line of code, the UE (I used 5.3) main and sub behavior trees can only be the same blackboard, or the main behavior tree’s blackboard is child of sub behavior tree’s blackboard.

And for “Run Behavior Dynamic”
BlackboardComponent.cpp

bool UBlackboardComponent::IsCompatibleWith(const UBlackboardData* TestAsset) const
{
	for (UBlackboardData* It = BlackboardAsset; It; It = It->Parent)
	{
		if (It == TestAsset)
		{
			return true;
		}

		if (It->Keys == TestAsset->Keys)
		{
			return true;
		}
	}

	return false;
}

Where BlackboardAsset is the blackboard of the main behavior tree and TestAsset is the blackboard of the sub behavior tree. It’s same.I don’t know why UE doesn’t reverse them, now you just have to make a big big blackboard for all the behavior trees.

1 Like