# UxmlSerializedDataPropertyDrawer

> A base property drawer for UXML serialized data that renders attribute fields in the Inspector.

## Definition

* **Type:** Class
* **Namespace:** [Unity.UIToolkit.Editor](/engine/6000.7/script-reference/unity/uitoolkit/editor.md)
* **Assembly:** UnityEditor
* **Inherits from:** [PropertyDrawer](/engine/6000.7/script-reference/unityeditor/propertydrawer.md)

```csharp
[CustomPropertyDrawer(typeof(UxmlSerializedData), true)]
public class UxmlSerializedDataPropertyDrawer : PropertyDrawer
```

## Remarks

Derive from [UxmlSerializedDataPropertyDrawer](/engine/6000.7/script-reference/unity/uitoolkit/editor/uxmlserializeddatapropertydrawer.md) and apply [CustomPropertyDrawer](/engine/6000.7/script-reference/unityeditor/custompropertydrawer.md) for a `UxmlSerializedData` type to customize how its attributes appear in the authoring Inspector. The base class generates a field for each visible attribute. Override [UxmlSerializedDataPropertyDrawer.CreateChildPropertiesGUI](/engine/6000.7/script-reference/unity/uitoolkit/editor/uxmlserializeddatapropertydrawer/createchildpropertiesgui.md) to control which attributes appear and in what order, and [UxmlSerializedDataPropertyDrawer.CreateChildPropertyGUI](/engine/6000.7/script-reference/unity/uitoolkit/editor/uxmlserializeddatapropertydrawer/createchildpropertygui.md) to control how each one is drawn.

Additional Resources: [UxmlAttributeField](/engine/6000.7/script-reference/unity/uitoolkit/editor/uxmlattributefield.md), [UxmlAttributeFieldDecorator](/engine/6000.7/script-reference/unity/uitoolkit/editor/uxmlattributefielddecorator.md)

The following example defines a minimal drawer that uses the default field generation.

## Examples

```csharp
// Inherit from UxmlSerializedDataPropertyDrawer and apply it to a UxmlSerializedData class.
// The [CustomPropertyDrawer] attribute associates this drawer with ColorfulButton.UxmlSerializedData.
[CustomPropertyDrawer(typeof(ColorfulButton.UxmlSerializedData))]
public class ColorfulButtonDrawer : UxmlSerializedDataPropertyDrawer
{
    // The base class generates property fields for all [UxmlAttribute] properties automatically.
    // Override CreateChildPropertiesGUI or CreateChildPropertyGUI to customize the layout.
}
```

## Methods

| Method                                                                                                                                                      | Description                                                                                                 |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| [CreateChildPropertiesExcluding](/engine/6000.7/script-reference/unity/uitoolkit/editor/uxmlserializeddatapropertydrawer/createchildpropertiesexcluding.md) | Creates a field for each visible attribute of the UXML serialized data, excluding the specified attributes. |
| [CreateChildPropertiesGUI](/engine/6000.7/script-reference/unity/uitoolkit/editor/uxmlserializeddatapropertydrawer/createchildpropertiesgui.md)             | Creates a field for each visible attribute of the UXML serialized data.                                     |
| [CreateChildPropertiesIncluding](/engine/6000.7/script-reference/unity/uitoolkit/editor/uxmlserializeddatapropertydrawer/createchildpropertiesincluding.md) | Creates a field only for the specified attributes of the UXML serialized data.                              |
| [CreateChildPropertyGUI](/engine/6000.7/script-reference/unity/uitoolkit/editor/uxmlserializeddatapropertydrawer/createchildpropertygui.md)                 | Creates the GUI for a single attribute of the UXML serialized data.                                         |
| [CreatePropertyGUI](/engine/6000.7/script-reference/unity/uitoolkit/editor/uxmlserializeddatapropertydrawer/createpropertygui.md)                           | Creates the root element for the property GUI. This method is sealed.                                       |

## Inheritance

**Inherited Members:**

* [PropertyDrawer.OnGUI(Rect, SerializedProperty, GUIContent)](/engine/6000.7/script-reference/unityeditor/propertydrawer/ongui.md)
* [PropertyDrawer.GetPropertyHeight(SerializedProperty, GUIContent)](/engine/6000.7/script-reference/unityeditor/propertydrawer/getpropertyheight.md)
* [PropertyDrawer.attribute](/engine/6000.7/script-reference/unityeditor/propertydrawer/attribute.md)
* [PropertyDrawer.fieldInfo](/engine/6000.7/script-reference/unityeditor/propertydrawer/fieldinfo.md)
* [PropertyDrawer.preferredLabel](/engine/6000.7/script-reference/unityeditor/propertydrawer/preferredlabel.md)
