Why does my behavior tree enum key not swtich

So, I have an enum with 2 states, attacking and patrolling. If the players heat goes over a certain number then state changes to attacking.

enumcpp.PNG

Now I tried to make a blackboard key with that name (I read somewhere that you can do that, so that I can check the states within my behavior tree. Like so:

But now in the Behavior tree, the enum doesn’t seem to change states.

However when I made a service blueprint it with one of those on state switches it definitely changes states.

Am I doing something wrong? Why isn’t the blackboard enum switching?

Nevermind, apparently you still have to set the black value manually by adding this line:

BlackboardComp->SetValue<UBlackboardKeyType_Enum>(BlackboardComp->GetKeyID(“BotStateEnum”), static_cast<UBlackboardKeyType_Enum::FDataType>(BotStateEnum));

A quick other question then. Is it better to put /set the enum states in the controller class or in the actual AI class itself? Logic dictates doing it in the AI class. But also not unreasonable to do it in the controller class.