Create and share a value

The blackboard is a fancy way of saying variable list. Behavior trees use blackboards in order to share values between tasks. You can think of each task as a modular piece of functionality and the blackboard helps share data throughout the entire tree. In Behavior Designer your blackboard can look similar to:

The Shared Variables panel lists six values available to tasks in the behavior tree.

This blackboard has six variables that are shared across the tree:

  • 1 GameObject array.
  • 3 GameObjects.
  • 2 Integers.

These variables can then be used by individual tasks by referencing them within the Task Inspector:

A task field is assigned to the Gather Animation Index Shared Variable.

With this setup the Gather Animation Index variable will be set to the inspected task. This will then allow the task to reference the same value across multiple tasks. For example, another task could look like:

A second task writes to the same Gather Animation Index Shared Variable.

Because both tasks reference the same blackboard variable, they share the same value. When Set Int writes 5 to Gather Animation Index, the other task reads that same value. See Variables for details about creating, scoping, and accessing shared data.