Behavior Tree
Fully cross-platform behavior tree implementation designed with code-first OOP principles. Features reactive evaluation, simplified node callbacks, dependency injection instead of blackboards, and text-based visualization. Works in Unity or as a standalone C# library.
com.bananaparty.behaviortree 
Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/behaviortree.git README Markdown
Copy this to your project's README.md
## Installation
Add **Behavior Tree** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/behaviortree.git
```
[](https://www.pkglnk.dev/pkg/behaviortree)README
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.2.0
See minimum required Unity version in the package.json file.
Key differences from BehaviorTree in UnrealEngine, BehaviorDesigner, and NodeCanvas:
- Code-oriented. Built using best OOP practices.
- Trees are built by using nested constructors. Beware, it's all code.
- There are only 2 node callbacks,
OnExecuteandOnReset.- Determining whether a node just started executing in
OnExecuteor being interrupted inOnResetis accomplished by comparing the currentNode.Status.
- Determining whether a node just started executing in
- "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
ReactiveSequenceandReactiveSelector.
- It's as simple as all nodes being reevaluated every frame in
- 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.
- In case of multiple Actions in a self-interrupting Sequence (
- 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.
- 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.
No comments yet. Be the first!