Page cover image

Binding Values

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.

Enable Binding for a field

Once the bind control appears on left-hand side of the field, click on it to bound the field.

Bind Control on a field

Once the field is bound, the data pipeline will be seen with some controls to set it up.

Bound Field

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.

Data Pipeline

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:

Data Pipeline Read Mode Example

Smart Dropdown

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.

Default view of Smart Dropdown

When selecting a bind path, the custom dropdown lets you select direct entries:

Direct Values

Or compound entries when both the direct entry and its children are valid choices:

Compound Values

Or search a value among the ones present:

Search Values

Bindings Update Points

Code based bound fields (with Bind<T>) are refreshed in user-code and don't need automatic refreshes.

The system automatically refreshes bound fields to keep them always with the latest available data. The update logic is very fast but it still incurs a small overhead. To avoid wasting performance, the system allows to decide at which point a bound field should be refreshed. There are several predefined points that you can select:

Update points

Here are the update points:

  • Editor: will refresh the bound fields during Editor frame update. Enable this point if you need to see the changes without going to Play mode.

  • Update: will refresh the bound fields during Update phase at runtime. This is the default update point.

  • Late Update: will refresh the bound fields during Late Update phase at runtime.

  • Render: (Available from version 2.2.2) will refresh the bound fields just before rendering the frame. This is useful when refreshing fields linked to animations and IK calculations.

  • Fixed Update: will refresh the bound fields during Physics update phase. Useful when dealing with fields linked to physical simulations.

  • On Change: will refresh the bound fields in any of the previous points (except Render and Editor) and only if the source value has changed.

Since version 2.2.2 it is possible to manually refresh a bound field, through Unity Events. Simply select the bound field to update from the available options and it will refresh when the event is raised. This is useful when you want more control over when to refresh the bindings.

When a bound field is selected in the event, a button will appear with the field. Clicking on it will open the bound field popup from where you can do adjustments. Control (or CMD on MacOS) + Clicking will highlight the bound field in the inspector.

Last updated

Was this helpful?