← all repositories
ashblue/fluid-behavior-tree

Behavior trees you can actually read at 2 a.m.

A Unity library that trades visual node spaghetti for fluent C# builders and runtime debugging.

1.2k stars C# AgentsDomain Apps
fluid-behavior-tree
Velocity · 7d
+0.4
★ / day
Trend
steady
star history

What it does

Fluid Behavior Tree lets you build AI logic in Unity using chained C# method calls instead of dragging nodes around a graph. You construct sequences, selectors, conditions, and actions through a BehaviorTreeBuilder, then tick the tree each frame. It ships with common nodes (wait, random chance, repeaters, inverters) and restores execution position across frames so long-running behaviors don’t restart from scratch.

The interesting bit

The builder pattern isn’t just syntax sugar here—it’s the project’s bet against visual-scripting fragility in large codebases. Trees are plain objects you can compose, inject, and unit test. There’s also a runtime visualizer that prints the active tree in the editor, but only while the game is running; the tree has to be built first, which is a small admission that static inspection wasn’t worth the complexity.

Key highlights

  • Pre-built library of actions, conditions, composites, and decorators (including SelectorRandom with shuffle)
  • Custom nodes via inheritance and extension methods—add your own .MyAction() to the builder
  • Execution pointer tracks Continue status across Tick() calls; reset with .Reset()
  • Unity Package Manager install via scoped NPM registry
  • Capture-the-flag example project shows real-time usage

Caveats

  • Every composite and decorator requires an explicit .End() call; forgetting one breaks tree construction
  • Visualizer only works at runtime, not in edit mode
  • Scoped registry setup in manifest.json is required for installation

Verdict

Worth a look if you’re a Unity developer who prefers version-controlled C# over binary scene files for AI logic. Skip it if you’re already productive with visual behavior-tree editors or need non-Unity behavior trees.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.