How can i fix this UE5 c++ Behavior Tree System BlackBoard Component Error

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "ArenaBattle.h"
#include "AIController.h"
#include "ABAIController.generated.h"

/**
 * 
 */
UCLASS()
class ARENABATTLE_API AABAIController : public AAIController
{
	GENERATED_BODY()
	
public:
	AABAIController();
	virtual void OnPossess(APawn* InPawn) override;

	static const FName HomePosKey;
	static const FName PatrolPosKey;

private:
	UPROPERTY()
		class UBehaviorTree* BTAsset;

	UPROPERTY()
		class UBlackboardData* BBAsset;
};
// Fill out your copyright notice in the Description page of Project Settings.


#include "ABAIController.h"
#include "BehaviorTree/BehaviorTree.h"
#include "BehaviorTree/BlackboardData.h"
#include "BehaviorTree/BlackboardComponent.h"

const FName AABAIController::HomePosKey(TEXT("HomePos"));
const FName AABAIController::PatrolPosKey(TEXT("PatrolPos"));

AABAIController::AABAIController()
{
	static ConstructorHelpers::FObjectFinder<UBlackboardData> BBObject(TEXT("/Game/Book/AI/BB_ABCharacter.BB_ABCharacter"));
	if (BBObject.Succeeded())
	{
		BBAsset = BBObject.Object;
	}

	static ConstructorHelpers::FObjectFinder<UBehaviorTree> BTObject(TEXT("/Game/Book/AI/BT_ABCharacter.BT_ABCharacter"));
	if (BTObject.Succeeded())
	{
		BTAsset = BTObject.Object;
	}
}

void AABAIController::OnPossess(APawn* InPawn)
{
	Super::OnPossess(InPawn);
	if (UseBlackboard(BBAsset, Blackboard))
	{
	 Blackboard->SetValueAsVector(HomePosKey, InPawn->GetActorLocation());
		if (!RunBehaviorTree(BTAsset))
		{
			ABLOG(Error, TEXT("AIController couldn't run behavior tree!"));
		}
	}

}
ABAIController.cpp(30): error C2664

Severity code description project file line display error (suspension) status
Error (active) Cannot initialize reference in format E0434"UBlackboardComponent*&" (not const limited) to a value in format "TOBjectPtr<UBlackboardComponent>"Money White-Nyang".ArenaBattle C:\JunYongShin\UE\Projects\Cpt12\Source\ArenaBattle\ABAIController.cpp 30

Unable to pass the HomePos key value to the blackboard. I need some help

void AABAIController::OnPossess(APawn* InPawn)
{
Super::OnPossess(InPawn);
UBlackboardComponent* Blackboard;
if (UseBlackboard(BBAsset, Blackboard))
{
Blackboard->SetValueAsVector(HomePosKey, InPawn->GetActorLocation());
if (!RunBehaviorTree(BTAsset))
{
ABLOG(Error, TEXT(“AIController couldn’t run behavior tree!”));
}
}
}

1 Like