Porting project to 4.6...1 Unresolved external with UBehaviorTree StartTree ?

Hey… So i was porting my project to UE4 4.6 , I Changed all my classes constructors so they match the new method as well GENERATED_UCLASS_BODY to GENERATED_BODY… it compiles fine up until it reaches a specific line in my AIController class

AIController header




#pragma once

#include "AIController.h"
#include "TTCustomerAIController.generated.h"

/**
 * 
 */
UCLASS()
class THETAVERN_API ATTCustomerAIController : public AAIController
{
	GENERATED_BODY()
public:

	ATTCustomerAIController(const FObjectInitializer& ObjectInitializer);
	UPROPERTY(BlueprintReadOnly,Category = Controller)
	class UTTableSphereVolume* CurrentTableSphere;

	UPROPERTY(BlueprintReadOnly,Category = Controller)
	class ATTCustomerCharacter* CPawn;


	UPROPERTY()
	class UBlackboardComponent* BlackboardComp;

	UPROPERTY()
	class UBehaviorTreeComponent* BehaviorComp;

	UPROPERTY(BlueprintReadWrite,Category = Controller)
	bool bHasSeat;

	virtual void Possess(class APawn* InPawn) override; // this is the function

	UPROPERTY()
	bool bHasDrink;

	UPROPERTY()
	bool bIsDrinking;

	UPROPERTY()
	class UTTSeatComponent* CustomerSeat;
	
};

function where the error shows up




#include "TheTavern.h"
#include "TTCustomerCharacter.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "BehaviorTree/BehaviorTree.h"
#include "BehaviorTree/BehaviorTreeComponent.h"
#include "TTCustomerAIController.h"

void ATTCustomerAIController::Possess(APawn* InPawn)
{
	Super::Possess(InPawn);

	ATTCustomerCharacter* Bot = Cast<ATTCustomerCharacter>(InPawn);

	// start behavior
	if (Bot && Bot->BotBehavior)
	{
		BlackboardComp->InitializeBlackboard(Bot->BotBehavior->BlackboardAsset);

		BehaviorComp->StartTree(*(Bot->BotBehavior)); // Here!, Bot is the character pointer and BotBehavior is a pointer to UBehaviorTree

		RunBehaviorTree(Bot->BotBehavior);
	}
}

and the error itself is


error C2664: 'bool UBehaviorTreeComponent::StartTree(UBehaviorTree *,EBTExecutionMode::Type)' : cannot convert argument 1 from 'UBehaviorTree' to 'UBehaviorTree *'
1>          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

I Even compared my code to the shootergame demo, it uses the exact same method and yet it actually fails to compile on me with the same error

Any help is always appreciated

hey,
i had the same problem, in my case
this was really helpful:

Thanks, i saw in the tread you linked that StartTree takes a reference instead of a pointer so im dereferencing my pointer and using that instead but it still fails to compile

Why would you do that? The compiler told you it expects a pointer, so give it a pointer.

Alright it seems that the UBehaviorTree class dident got updated properly when switching to 4.6… I just opened its header and the function was still asking for a pointer instead of a reference, switched it to a reference and now its working as it should