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!