Learn how to use NodeCanvas

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, or be bound to a static property/field. 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 gear button and select the property you want to bind the variable to!


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. Alternatively, you can simply create a new data bound variable directly without having a variable pre-exist on the blackboard as shown below.

Yes No Suggest edit
62 of 64 users found this section helpful
Suggest Edit