Enum change not reflected in Behavior Tree decorator calculations

I’ve been noticing some strange issues with the ‘Compare Blackboard entries’ decorator in the behavior trees lately. I didn’t receive any reply regarding my previous issue which I posted here:
Trouble with Behavior Tree Decorators
However not knowing if it was a bug, I finally found a workaround to that.

But today when I was comparing two enum values, I came upon another issue which I think is a bug. The compare decorator was working for the past few days, but today I had changed the enum to include one extra element. Ever since then, the behavior trees were acting weirdly with the compare decorator ignoring it. While debugging, I can see that all the values are correct, but it was still not working. I tried restarting the project, but to no avail. I’ve even deleted the old blackboard entries and created new similar ones with different names, just in case the addition of enum wasn’t updated in the blackboard.

Later I found out that the reason was that the enum index change while adding a new element was not getting updated in the decorator calculations. So I rearranged the enum to give the individual entries have the same initial index values and the Behavior Tree started working as expected.

Hi Stormrage,

I am attempting to reproduce this issue with a fresh project, but I am not sure if I’ve set this up the same way. Can you please provide a screenshot of the behavior tree where this occurs? An image of the BP that is changing the enum value as well may help. Also, what version of UE4 does this occur in?

Any additional information may help, thanks!

Yea sure, I’m using v4.7.4. Here are some screenshots of the workflow that I used:

First there is the initial Behavior Tree that was working fine:

Here the ‘DefaultCombatMode’ enum always contains the value ‘Combat Mode’, while the ‘GameplayMode’ enum is changed based on user input. However since they are not equal at level start, The behavior tree passes through it as expected. Here’s a shot of the enum:

Yesterday, I added a new value to the enum and had it as the first element, while moving the ‘CombatMode’ to the last:

As you can see in the screenshot below, the behavior tree fails to do the decorator calculations correctly, even though the values are shown as different in the blackboard details.

Then I changed the order of enum to match the original enum with the added element as the last one:

And now as you can see from the screenshot below, it’s working perfectly fine:

So basically when rearranging the enums after addition of a new element, it fails to get reflected in the calculations for the compare decorator.

Hi Stormrage,

Thanks for that additional information. I was able to distill the problem down to its core elements and entered a ticket to the AI team for the bug. I included a lot of screenshots and information that you provided to help them locate the exact cause.

Please let us know if anything else unexpected begins happening.