luis-l / BonsaiBehaviourTree

An advanced behaviour tree solution for the Unity game engine
MIT License
417 stars 45 forks source link

selector branch are not reevaluated? #14

Closed delmarle closed 4 years ago

delmarle commented 4 years ago

https://gyazo.com/7f2363ea32ec669d66baea3aa477be18

in this example i want the combat branch to run if the value has player is true. the tree start with value true so it run the left side of the branch. i change to false then the selector will run the idle task on the right but when i change it back to true then the left side "combat branch" is not evaluated again.

how can i fix this? other behavior tree i used got this behavior working

luis-l commented 4 years ago

The behaviour tree is implemented so it does not re-evaluate to traverse. This was done mainly for performance reasons.

There are a few mechanisms to do branch re-evaluation.

The Utility Selector always re-evaluates at an interval to run the highest utility branch.

For your scenario, maybe a conditional abort can be used to switch to the combat branch.

I made a discord channel for the project if you want to chat on usage: https://discord.gg/pXsMjh