This is a framework I have been working on occasionally for the past year. I wanted to familiarize myself with behavior trees and how they worked, as well as create a tool that I could use easily in my own projects. A behavior tree is a data structure that is used to model the behavior of AI-agents, usually NPCs. A tree is build from leaf nodes and branch nodes. The leaf nodes are either conditions, which check if a certain condition is met, or tasks, which make the agent act out a behavior. An example of a condition is: “Is the player character near me?”. An example of a task would be “Move this agent towards the player”. Branch nodes are often called composites, and they manage if and when their child nodes should be evaluated and executed. Examples of are sequences, which execute each child node in sequence after the previous child node succesfully terminates, and selectors, which tries each of it’s children until one of the successfully terminates.
The central idea is behind my framework that because the Unity Hierarchy window is structured as a tree graph, I could leverage that to structure behavior trees so there would be no need for a separate tree-editor window. Because the framework is written in C# and build using common Unity types (MonoBehaviours), I hope that it will be easily integrated into the workflow of Unity users. I am planning to start running user tests after I finish my current phase of functional testing to see if it works intuitively. If it does, I might at some point try to sell it on the Unity asset store as a cheap alternative to current behavior tree plug-ins.