# How to use Behavior Tree Enum cpp

**URL:** <https://forums.unrealengine.com/t/how-to-use-behavior-tree-enum-cpp/495353>\
**Category:** C++\
**Tags:** Behavior-Tree, ENUM, unreal-engine, CPP, UE4-27, question\
**Created:** [February 7, 2022, 4:28pm UTC](https://forums.unrealengine.com/t/how-to-use-behavior-tree-enum-cpp/495353 "2022-02-07T16:28:56Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![akaPrometh](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@akaPrometh](https://forums.unrealengine.com/u/akaPrometh)\
**Post date:** [February 9, 2022, 2:26pm UTC](https://forums.unrealengine.com/t/how-to-use-behavior-tree-enum-cpp/495353/3 "2022-02-09T14:26:07Z")

</div>

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](https://forums.unrealengine.com/u/Mewbits) in

> [@Why enum, declared in c++ does not accessible to choose if BlackBoard?](https://forums.unrealengine.com/t/why-enum-declared-in-c-does-not-accessible-to-choose-if-blackboard/45884/4):
>
> I’m having the exact same issue. I declared the Enum the same way (except without the =0 part) and restarted the engine after compiling the code. It’s located in a header file that is listed in my project header file so that it’s accessible anywhere in the project. I can create variables and reference it anywhere. Except I can’t set it as the Enum type in Blackboard. Did you ever find a way to fix this issue? I’m in UE 4.23 Edit: Found the solution:

Eh, more weird cpp exceptions ‘blackmagic’ 🙄

---

_[View the full topic](https://forums.unrealengine.com/t/how-to-use-behavior-tree-enum-cpp/495353)._
