How to use Behavior Tree Enum cpp

Hi,
I cannot find any resource on how to implement cpp enums for Behavior Trees.
I have UE generate me this, but no idea on how to fill it.
Thanks <3 !

/**
 * 
 */
UCLASS()
class TPSMPPG_API UBBKE_AIState : public UBlackboardKeyType_Enum
{
	GENERATED_BODY()
	
};

This is how I create enums in CPP
Create new empty C++ class in unreal editor
editor will create header and cpp files for you
in .h file replace generated class by the content below:

UENUM(BlueprintType)
enum class EUBBKE_AIState : uint8  
{
	OptionOne, 
	OptionTwo
};

In cpp file remove generated constructor and destructor.
After compile EUBBKE_AIState enum should be visible in BT and in Blueprints too

Thanks Phoebus89
You gave the correct steps to create an enum in CPP.
Turns out the UBlackboardKeyType_Enum unreal4 proposed me is… useless for this case.
A ‘simple’ enum is enough.

However these arent enough to use the enum as a Blackboard variable type.
It appears we have to manually input the enum’s name in the field ‘Enum Name’ and then unreal will autofill ‘Enum Type’
For example see answerof Mewbits in

Eh, more weird cpp exceptions ‘blackmagic’ :roll_eyes:

1 Like

@akaPrometh, thanks a lot! I was also wandering how to add C++ enum to Behavior Tree. Current way is really not obvious!