4.6 AI possess override doesn't works anymore

Hey guys ,

since i upgrade all my project to 4.6 coding standards , my override of Possess doesn’t works anymore :


void AAIControl::Possess(class APawn *InPawn)
{
	Super::Possess(InPawn);
	AAICharacter *ai = Cast<AAICharacter>(InPawn);
	if (ai && ai->AIBehavior)
	{
		blackboardComp->InitializeBlackboard(ai->AIBehavior->GetBlackboardAsset);  // doesn't works
		EnemyKeyID = blackboardComp->GetKeyID("Enemy");
		EnemyKeyID = blackboardComp->GetKeyID("Location");
		behaviorTreeComp->StartTree(ai->AIBehavior); // doesn't works
	}
}


blackboardComp->InitializeBlackboard(ai->AIBehavior->GetBlackboardAsset);

ai is underlined and vs tells : “Error : pointer to incomplete class type is not allowed” ( the .h is included)


behaviorTreeComp->StartTree(ai->AIBehavior);

ai is also underlined and vs tells : "Error : a reference of type "UBehaviorTree & " (not const-qualified) cannot be initialized with a value of type "UBehaviorTree* " "

Errors log when i compile :


Error	1	error C2027: use of undefined type 'UBehaviorTree'	
Error	2	error C2227: left of '->GetBlackboardAsset' must point to class/struct/union/generic type	
Error	3	error C2664: 'bool UBehaviorTreeComponent::StartTree(UBehaviorTree &,EBTExecutionMode::Type)' : cannot convert argument 1 from 'UBehaviorTree *' to 'UBehaviorTree &'	


I also included the AI module on Build.cs and the behavior tree headers on my ai code

If someone know the solution . ( By the way , i downloaded the shooter game example 4.6 version, and it works (still using <4.6 coding standards )

Have a nice day

That error will show on the first pointer if any class in a dereference chain is not included. So make sure you’re including BehaviorTree.h.

StartTree was changed to take a reference to a UBehaviorTree instead of a pointer to one. So dereference that pointer.

After re-checking , i forget a .h in my header copy/paste my bad :frowning:

For the second problem , thanks ! you teach me the word “deference” and its method , which will be really useful for the future !