← All projects

Developer tool

Behavior Graph

A custom Behavior Tree tool for Unity: a graph editor and runtime for configuring enemy behaviour.

UnityC#Unity EditorGraphViewBehavior TreeScriptableObject
Behavior Graph

Overview

Behavior Graph is a custom Unity tool for authoring and configuring behaviour trees. It combines a Unity Editor graph editor with a runtime tree so that enemy behaviour can be assembled from visual nodes and stored with game assets.

What it includes

  • A ScriptableObject graph asset storing nodes, connections, the root node, and canvas positions.
  • A GraphView editor with node search, connecting and disconnecting, positioning, and root-node assignment.
  • Composite Selector, Sequence, and Parallel nodes; Invert, Force Success, and Timeout decorators.
  • Actions for waiting, condition checks, movement strategies, target attacks, and area damage.
  • A runtime node lifecycle with entry, execution, completion, forced stop, and Success, Failure, and Running states.

Behaviour debugging

During Play Mode the editor can attach to a selected object using the open graph and highlight its runtime node states. This makes it easier to see the active branch and investigate enemy behaviour.

Technical foundation

Serializable node descriptions are separated from runtime nodes and converted into executable objects through factories. Connection capacity is validated, and child order in composites is derived from graph position, enabling visual authoring while keeping the graph as a Unity asset.