Documentation

Learn how to use NodeCanvas

Download PDF Version

Data Binding Variables

Variables added in a Blackboard can be data-bound to public properties and/or fields of any component that exist on the same game object as the Blackboard. Data binding can be one-way or even two-ways, depending on whether the property can read and/or can write. Data binding a variable to a property means that whenever you are getting the variable value, you will be getting the value of the property instead and whenever you are setting the variable value, you will be setting the property value instead. This is very powerful because it allows you to use Blackboard variables as a direct bridge to your own code without the need to use redundant tasks for setting that variable beforehand.

To bind a variable to a property you simply have to click the variable options button and select the property you want to bind the variable to!

VariableBind

As a more practical example, let’s suppose you have this simple script attached to the same game object as the Blackboard.

And on that Blackboard, you have a float type variable. By clicking the variable options button you will get a context menu to bind the variable with any float type property existing on any component on the game object. In this case, our DataBindExample component.

DataBind1

 

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