Blackboard Values Not Saving in Behavior Tree

I’m attempting to build a simple behavior tree where a turret will “Sleep” if the player character is outside the range of its active area.

I have been able to work out the logic for determining distance along with the various actions that should be taken when a behavior tree selector passes as the result of an evaluation on its decorator.

Right now, the decorator consistently fails (leaving me in the sleep state, and refusing to wake.) This is because when I invoke “Set BB Value as Int” inside of the sleep task (as part of the result of a successful distance check) the value in the blackboard data is not being persisted.

I am confirming that this is the case by printing the value of the retained “State” at the beginning of the task, and then printing it again at the end of the execution of the task (just before finishing execution.)

I am wondering if anyone else is seeing an issue like this, and if there might be a step I’ve left out in the construction of Blackboard, Behavior Tree, Task and Enumeration.

Example code that outputs “0” in both cases regardless of call path.

First, you mist define and assign all the variables in the Blackboard.

Second, for each variable used on every Beheavior tree/service, you must assign which blaboardkey value represents each.

Also… based on the screen, looks like you are using standard variables rather than blackboard key value types.

Did you get this fixed? I’m having a similar issue with setting BB values in a service, they are not setting.

the only workaround I found is tu se functions to get/set variables

Try this:

My issue with this was temporary and I got past it.

In the Behavior Tree Editor, select a node that uses any of the BlackBoard Values, and look to the details panel to the right. There will be a drop down combo box next to each BlackBoard Value, they default to the first one, so they will initially all be set incorrectly.

I forgot this step over the weekend because it had been a while since I was working in the Tree. Without it, none of my BB variables were changing at runtime.