Learn how to use NodeCanvas

Download PDF Version

Data Binding Variables

Variables added in a Blackboard, can be data bound to public properties of components 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 can write. Data binding a variable to a property, means that whenever you are getting the value of the variable, 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 having to set the variable before using it.

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


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

And on that Blackboard, you have a float type variable. 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.



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