Download

Enum working in behavior tree AI

Hey so I’m trying to use an enum in my code in my blackboard so I can use it in my AI behaviour tree and I typed the same enum name, it seems to have got it but it won’t change from the first value of the enum even when I change it in code no matter what. It just stays at the first same value.

UENUM(BlueprintType)
enum class ECurrentAIMode : uint8 {
CHASING UMETA(DisplayName = “CHASING”),
OFFENSIVE UMETA(DisplayName = “OFFENSIVE”),
DEFENSIVE UMETA(DisplayName = “DEFENSIVE”),
AMBUSH UMETA(DisplayName = “AMBUSH”),
SCATTER UMETA(DisplayName = “SCATTER”)
};

Thats the enum and it is defined as:
ECurrentAIMode CurrentAIMode = ECurrentAIMode::DEFENSIVE;

OnPaste.20210610-072202
Then in the behavior tree + blackboard, it gets the current ai mode but it won’t change from the first element in the list which is CHASING

Please can someone help me out, any help is much appreciated, thank you! :slight_smile:

You have to set the Blackboard value like any other type : SetValueAsEnum

I don’t see you mentioning it.

1 Like

Thank you so much! That was a stupid mistake haha :smiley: