UE 5.2 BehaviorTree not found

Hello everyone.

I’m following the Unreal Engine 5 C++ course on udemy and I’m programming the AI part: BehaviorTree and BlackBoard.

I declared a UBehaviorTree inside my .h file, then I set it in the BP of the AIController class, but my project cannot find it!

.h file where I declared BehaviorTree:

	class UBehaviorTree* AIBehavior;

.cpp file BeginPlay:

void APokemonAIController::BeginPlay()
	if (AIBehavior != nullptr) {
		UE_LOG(LogTemp, Warning, TEXT("AIBehavior not Empty!"));
	} else {
		UE_LOG(LogTemp, Warning, TEXT("AIBehavior Empty!"));

BP AIController:

Pawn’s BP where the AIController is sets:

But my log always says that the AIBehavior is empty:

What is the name of your blueprint AI controller? You might have selected the C++ one (3rd screenshot) which doesn’t have that property set.

Hi Dan.
The name of my blueprint is BP_PokemonAIController. The AI controller that I selected in the 3rd screenshot is the main C++ class.
I tried to change the C++ class with my blueprint like you suggest, without any improvement.

BUT, I solved it: I don’t know why, but apparently (I think this is a bug) the blueprint class that I created from the C++ main class couldn’t save my AIBehaviorTree, so when I selected I saw the selection but the engine not recognized the selection, so it was empty.
I solve this problem by creating a new bp class from my C++ AI class and then reselected my BehaviorTree, now is correctly sets in UE and is working.

Thanks for the help anyway!!!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms