Download

Behavior tree - change child index

Is there a quick way to change the “child index” of nodes under a ‘Selector’ node in a behavior tree? (the child index controls the priority of execution)

I have a particular selector that has numerous children and the priority of execution matters - if I wanted to add a new node in between the existing nodes is seems like the only way is to break links to all nodes beyond that point and rewire them one by one to regenerate the child indices.

Not sure if I’m missing something simple!

All that you should have to do to change the child index is drag the nodes under the selector to rearrange them in the order that you want from left to right. The UI currently (4.4.3) is not updating until you save the tree, but even if you play in the editor with out saving, the tree should use updated child index order. Here is a series of screenshots to illustrate this using the shooter game example behavior tree:

The tree before any changes:

The tree after reordering the nodes:
25163cb92bb791dcec5eb194051bcdec6cd86947.png

The tree after it has been saved:
30e7bec649ded08948889aeea082f52f1a4d7861.png

I will talk to someone about having the child index UI get updated after the node is moved to make this more clear.

Thanks a lot Stephan that indeed works! :slight_smile: