Home

Awesome

com.bananaparty.behaviortree

Unity package. Fully cross-platform Behavior Tree.
Does not reference Unity Engine, so it could be used in a regular C# project.

Make sure you have standalone Git installed first. Reboot after installation.
In Unity, open "Window" -> "Package Manager".
Click the "+" sign at the top left corner -> "Add package from git URL..."
Paste this: https://github.com/forcepusher/com.bananaparty.behaviortree.git#6.0.1
See minimum required Unity version in the package.json file.

Key differences from BehaviorTree in UnrealEngine, BehaviorDesigner, and NodeCanvas:

  1. Code-oriented. Built using best OOP practices.
    • Trees are built by using nested constructors. Beware, it's all code.
  2. There are only 2 node callbacks, OnExecute and OnReset.
    • Determining whether a node just started executing in OnExecute or being interrupted in OnReset is accomplished by comparing the current Node.Status.
  3. Reactive Evaluation/Conditional Aborts/Observer Aborts are implemented similarly to how it's done in NodeCanvas rather than in BehaviorDeisgner or UnrealEngine.
    • It's as simple as all nodes being reevaluated every frame in ReactiveSequence and ReactiveSelector.
  4. No separation between Actions and Conditions.
    • In case of multiple Actions in a self-interrupting Sequence (ReactiveSequence), you would need to group them togehter into an additional Sequence, so Actions aren't starting from the beginning every frame.
  5. No such concept as a Blackboard.
    • Inject the classes (or their interfaces) you need to mutate via constructor. However, you can still write a DTO and use it as a Blackboard.
  6. Text-based visualization.
    • Execution status of an entire tree could be viewed in a build.

The library assumes that you're familiar with OOP and BehaviorTrees.
There are no Samples yet, refer to the Tests folder instead.