Binding Values
Last updated
Last updated
The Binding System 2 was designed to help you link objects as quick and simple as possible. Most of the fields are bindable out of the box, in most of the scripts, objects, materials and components. If a field is serialized and its drawer includes a BeginProperty call, it can likely be bound. By default, all fields in scripts with standard drawers are bindable, meaning your scripts and third-party scripts using Unity-compliant drawers are fully compatible.
To bind a field, hover over the field and right click on it to reveal a property menu. In this menu, select Enable Binding.
Once the bind control appears on left-hand side of the field, click on it to bound the field.
Once the field is bound, the data pipeline will be seen with some controls to set it up.
This drawer makes it easy to configure bindings within the Inspector. Additionally, the BindingSystem is compatible with the Odin Inspector, a popular Unity extension.
To disable binding for a field, do the process above in reverse: first unbind the field, then right click on the field and select Disable Binding.
Binding fields is non-destructive, meaning the serialization logic of the field is left untouched and all bind related serialization data is serialized in a different place.
This may not be the case when Update in Edit Mode is enabled, in this case the value will be updated and overwritten over its original data.
Data Pipeline is handling the data through a set of stages, some of them optional, to deliver it to its destination. The direction of the pipeline depends on selected BindMode value. When "reading" data, the data goes from bind source property to bound field, that is, from right to left. When "writing" on the other hand, the data goes from bound field towards bind source property. By default, the bind mode is set to Read.
The stages are listed below in the image:
The BindingSystem provides a custom-built searchable dropdown menu that simplifies the access and setup of each binding property.
When clicking on path control or any other Bind option button, a custom dropdown, Smart Dropdown, will appear with relevant information or options to choose from. It can handle different types of data controls, such as checkboxes, input fields, buttons, groups, and more.
When selecting a bind path, the custom dropdown lets you select direct entries:
Or compound entries when both the direct entry and its children are valid choices:
Or search a value among the ones present: