기술 자료

Unity Engine


User Manual

Script Reference

Unity Engine


Binding system implementation details

Learn how the Editor binding system is implemented.
읽는 시간 1분최근 업데이트: 25일 전

The following is an explanation of how the UI 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