CreateChildPropertiesGUI(VisualElement, SerializedProperty)
Creates a field for each visible attribute of the UXML serialized data.
Read time 1 minuteLast updated 13 days ago
Definition
- Type: Method
- Namespace: Unity.UIToolkit.Editor
- Assembly: UnityEditor
protected virtual void CreateChildPropertiesGUI(VisualElement container, SerializedProperty property)
Parameters
The parent element to add the fields to.
The serialized property that represents the UXML serialized data instance.
Remarks
The default implementation calls UxmlSerializedDataPropertyDrawer.CreateChildPropertyGUI for each visible attribute, in declaration order. Override this method to show only specific attributes or to change their order. Call UxmlSerializedDataPropertyDrawer.CreateChildPropertiesExcluding to exclude specific attributes by name whilst keeping the default order and property drawers for the rest.
The following example shows only specific attributes by name.
Examples
// Override CreateChildPropertiesGUI to display only specific properties.[CustomPropertyDrawer(typeof(SelectiveButton.UxmlSerializedData))]public class SelectiveButtonDrawer : UxmlSerializedDataPropertyDrawer{ protected override void CreateChildPropertiesGUI(VisualElement container, SerializedProperty property) { CreateChildPropertiesIncluding(container, property, "color", "text"); }}