Unable to create class inherited from UBTTask_BlackboardBase

I am attempting to implement a basic behaviour tree in code using this tutorial as a base. From a Basic Code project I enable behavior tress from the experimental menu, add code to the project inherited from BTTask_BlackboardBase, then close the editor, go to Visual Studio and build the project without changing the new class, but I get this error:

Superclass BTTask_BlackboardBase of class MyBTTask_BlackboardBase not found

And from that, error MSB3073.

For reference, here’s the default derived class:

#pragma once

#include "BehaviorTree/Tasks/BTTask_BlackboardBase.h"
#include "MyBTTask_BlackboardBase.generated.h"

/**
 * 
 */
UCLASS()
class BEHAVIOURTREES_API UMyBTTask_BlackboardBase : public UBTTask_BlackboardBase
{
	GENERATED_UCLASS_BODY()

	
	
};

Daft question but I’d rather learn in C++ rather than blueprints.

Looks like it should work. My only suggestion is that you made sure you have AIModule declared as your project’s dependency. This is done via YourProjectName.Build.cs file, it should be adding “AIModule” to PublicDependencyModuleNames.

–mieszko

That was it, thank you. Will keep a note of checking that file in future.

I do not know why it does not work to me. I do that like following

PublicDependencyModuleNames.AddRange(
new string {
“Core”,
“CoreUObject”,
“Engine”,
“OnlineSubsystem”,
“OnlineSubsystemUtils”,
“AssetRegistry”,
“AIModule” } );

This is it! Works. There should be some automation on this.

As on 4.17.1 I had to include both “AIModule” and “GameplayTasks” in the YourProjectName.Build.cs file to make it compile.