Version: 2021.3
Language : English
Bindable data types and fields
Binding examples

Binding system implementation details

The following is an explanation of how the UI(User Interface) Allows a user to interact with your application. Unity currently supports three UI systems. More info
See in Glossary
Toolkit binding system works at the implementation level.

Binding creation

When you call the Bind() method, it synchronizes and tracks the first value asynchronously. This means that the value property of the fields can’t update immediately. This allows you to set up binding for hierarchies that aren’t yet added to any UI.

Change detection

The binding system relies upon the serialized data of Unity objects to implement change detection.

After you create a binding between a SerializedObject and one or more elements, the system polls this object for changes at a regular interval, but not every frame, in two steps:

  1. The system serializes and polls the SerializedObject in native code to detect any change to serialized bytes. If there are no changes, it stops.
  2. If there are changes, the system compares the property and the displayed value on the bound element. If needed, the system updates the displayed value. It does this for each specific property-to-element binding for the given object.

Operation throttling

Some binding operations might be too long to handle in a single frame. If the binding operations are handled in a single frame, the UI might become unresponsive. To prevent this, these binding operations might happen across several frames. For example, it might take several updates to detect changes, depending on the number of objects polled.

Additional resources

Bindable data types and fields
Binding examples
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961