Error C2027 use of undefined type 'UBlackboardComponent'

Hello,

I was following the course and everything was working fine until I wanted to compile it now and it gave me an error.
The error is telling me that UBlackboardComponent is not defined, so I included its header file (BrainComponent.h) but that didn’t help at all.
I’ve looked through the video 3 times and I’ve written everything the same as Sam did, so that can’t be a problem either, unless I’ve looked over something 3 times, in case that is the problem, sorry.
I’ve also found online that I maybe have to forward declare it but since I don’t use it directly as a variable I don’t really know how.
And thus I have decided to ask for help here.

my .cpp file

#include "BTTask_ClearBlackboardValue.h"
#include "BrainComponent.h"


UBTTask_ClearBlackboardValue::UBTTask_ClearBlackboardValue()
{
    NodeName = TEXT("Clear Blackboard Value");
}

EBTNodeResult::Type UBTTask_ClearBlackboardValue::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
    Super::ExecuteTask(OwnerComp, NodeMemory);

    OwnerComp.GetBlackboardComponent()->ClearValue(GetSelectedBlackboardKey());
    return EBTNodeResult::Succeeded;
}

my header file

#pragma once

#include "CoreMinimal.h"
#include "BehaviorTree/Tasks/BTTask_BlackboardBase.h"
#include "BTTask_ClearBlackboardValue.generated.h"

/**
 * 
 */
UCLASS()
class SIMPLESHOOTER_API UBTTask_ClearBlackboardValue : public UBTTask_BlackboardBase
{
	GENERATED_BODY()
	
public:
	UBTTask_ClearBlackboardValue();

protected:
	virtual EBTNodeResult::Type ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) override;
};

Any help is much appreciated!

That’s not the header.

#include "BehaviorTree/BlackboardComponent.h"

- From the docs:
UBlackboardComponent | Unreal Engine Documentation

Thanks, Dan!
I included BrainComponent.h because the error said it was in there (I just realized I didn’t include the error message in the post, sorry), but I should’ve looked further and into the UE Docs.
I’m asking for help with all the errors that I get now so that when I try alone I might remember one of your solutions and fix it that way.

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

Privacy & Terms