Version: 2023.2
Language : English
Customize UXML tag names and attributes
Define a namespace prefix

Bind custom controls to data

You bind custom controls to serialized properties to synchronize values between the control and the property. You can create a bindable custom control derived from the BaseField generic base class instead of BindableElement. This provides the following advantages:

  • Implements the INotifyValueChanged interface for the generic parameter type that you specify.
  • Makes the control focusable by default.
  • Provides a horizontal layout with a label element on the left and input on the right.
FloatField is a built-in UI Toolkit control which inherits from BaseField.<br/>A. The label element.<br/>B. The input element.
FloatField is a built-in UI Toolkit control which inherits from BaseField.
A. The label element.
B. The input element.

Note: It’s possible to create custom controls derived from built-in UI(User Interface) Allows a user to interact with your application. Unity currently supports three UI systems. More info
See in Glossary
controls if you understand their internal hierarchy and existing USS classes. Unity discourages this practice because your custom controls might be dependent on their internal structure, which is subject to change in the future.

To bind custom controls to data:

Refer to SerializedObject data binding for more details.

For a bindable custom control example, refer to Create a bindable custom control.

Additional resources

Customize UXML tag names and attributes
Define a namespace prefix
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961