How to abort behavior subtree

When using “Run Behavior” from another behavior tree, aborting from the calling behavior tree does not abort in the child behavior. Is this expected? If so, is there a good way to work around it?

Any help is appreciated :slight_smile:

EDIT: After further investigation, it seems that removing “Has a Location” decorator in the subtree allows it to work:

Before:

16514-doesnotabort.png

After:

16515-willabort.png

And this is what the decorator looks like: (Note: the subtree aborts perfectly when copy-pasted into the main tree)

I don’t quite understand why this decorator is stopping this from working? Has anyone experienced this?

I have managed a workaround for this issue:

Originally, I was setting the ‘TendToNeeds’ variable using “GetBlackboard->SetValueAsBool”. Changing this to a BlackboardKeySelector passed in seems to have worked in both trees (at least in this instance).

Thanks for reporting this bug.

Code fix in BehaviorTreeManager.cpp - at the end of InitializeNodeHelper() function, replace line:

CompositeOb->InitializeComposite(InitList.Num() - 1);

with:

CompositeOb->InitializeComposite(ExecutionIndex - 1);