Learn how to use NodeCanvas

The Blackboard

The Blackboard is a place in which you store variables into and then read/write to those variables for any purpose. When you attach any GraphOwner on a gameobject, a Blackboard is also attached for you automatically. This represents the Blackboard of the GraphOwner and as such any graph that will be used by that owner, will be using this blackboard to exchange variables between nodes and tasks, but you are also free to read/write to those variables directly with an easy API. On top of this GraphOwner Blackboard, the graph itself also has a local Blackboard of its own. When editing the graph, both Blackboards are appended together and both are available for you to use.

Blackboards can store any type of variable. In editor and when you click the “Add Variable” button though, it will seem that only a specific list of types will show up. To modify this list of types, all you have to do is open up the Preferred Types Editor and modify the list of types there. This is simply done for editor convenience and to avoid menu clutter.

Variables are able to be Data Bound to properties and fields on any component attached to the same game object that the blackboard is attached to (or any static property/field). This is extremely useful to create a direct bridge of a variable to a property/field both back and forth and thus interface with existing code directly. Binding a variable can simply be done through the gear variable button.

Variables on the Blackboard component also support prefab overrides more or less the same way that you would expect them! When a variable is overridden, a vertical blue-ish marker is displayed on the left of the variable name (similar to normal Unity marker). Applying or Reverting a variable can simply be done through the gear variable button as well.

Blackboards are also able to Save and Load their variables state, which can prove useful for creating persistent states between different gaming sessions or even complete save systems. This has to be done via coding however, or by using the respective Action Tasks (Save Blackboard and Load Blackboard).

Yes No Suggest edit
26 of 26 users found this section helpful
Suggest Edit