Skip to content
Bit Quirky Behavior Trees and
State Machines

Search documentation

All topics and APIs

Close returns focus to Search.

What are you looking for?

Try a common topic or enter a complete API identifier.

Browse the reference instead

Esc closes · Tab reaches results · Enter opens the focused link

v0.6.0
Menu

Bit Quirky · Unity documentation

Give your game a plan.

Draw the decision once, watch it run in the editor while the game plays, and keep the movement, damage, and animation in your own C# components.

GameObject and entity paths
The enemy state machine running Live while the game plays. The player lands on the patrolling enemy from above and the machine switches to defeated.
The enemy state machine running Live while the game plays. The player lands on the patrolling enemy from above and the machine switches to defeated.

Three things this buys you

  • Decide visually

    One graph holds the whole decision, so the person asking for a behavior change can read the behavior.

    See the rule it follows
  • Keep your code

    Nodes call methods, properties, and events on the components you already wrote. Movement, damage, and animation stay yours.

    See how binding works
  • See why it happened

    Attach to a running agent and the nodes color as they run, with the values each one used.

    Watch a running graph

Four families of node

Every graph is built from these four jobs. Each node opens its reference entry.

Authoring, start to finish

Add a Sequence, drop a Method under it, point it at one of your own components, and pick the method. The binding is checked as you go.

Building a graph from empty in the Behavior Tree Editor. A Sequence root, a Method node under it, then the member picker binding CancelPatrol on the enemy's own patrol component.
Building a graph from empty in the Behavior Tree Editor. A Sequence root, a Method node under it, then the member picker binding CancelPatrol on the enemy's own patrol component.

A tree inside a state

A state machine holds the mode. A behavior tree decides what to do while that mode is active. The Platformer enemy uses one of each: patrolling and defeated are modes, and the patrol itself is a small plan.

A state machine with a behavior tree inside one stateThree states run in order: Patrol, Combat, and Defeated. A transition leads from Patrol to Combat when the player is seen, and from Combat to Defeated when the enemy is stomped. Combat hosts a Selector that tries Attack first, then Chase, then Look around, and stops at the first branch that runs.player seenstompedPatrolCombatDefeatedBehavior tree inside CombatSelectorAttackpriority 1Chasepriority 2Look aroundpriority 3A state machine with a behavior tree inside one stateThree states run in order: Patrol, Combat, and Defeated. A transition leads from Patrol to Combat when the player is seen, and from Combat to Defeated when the enemy is stomped. Combat hosts a Selector that tries Attack first, then Chase, then Look around, and stops at the first branch that runs.player seenstompedPatrolCombatDefeatedBehavior tree inside CombatSelectorAttackpriority 1Chasepriority 2Look aroundpriority 3
The machine holds one mode at a time. While Combat is the mode, a Selector inside it tries Attack, then Chase, then Look around.
Start here

What you get

Four games to explore

The asset includes four fully working sample games, each showing a different way to use the tool. Play them to learn it, read their graphs to see how, or take one as the starting point for a game of your own.

  • The Platformer enemy graph open in Live while the player lands on the patrolling enemy.

    Platformer

    An enemy walks its ledge until you land on its head, then drops to Defeated.

  • A Dungeon Heist guard turning off its patrol route to sweep the spot where a coin landed.

    Dungeon Heist

    Throw a coin and the guard breaks off its route to go and look.

  • A Horde Survival wave with one graph instance per enemy, all evaluating at once.

    Horde Survival

    A director picks the next wave while entity agents tick in jobs.

  • The Racing Line field launching together from the gantry countdown on the oval.

    Racing Line

    A CPU driver recovers from a spin and hunts the car ahead.

Ready to open the editor?

Install the package, create a graph, and get an object in your own scene moving in one sitting.

Start here

Full-size image