# CreatePropertyGUI

> Creates the root element for the property GUI. This method is sealed.

## Definition

* **Type:** Method
* **Namespace:** [Unity.UIToolkit.Editor](/engine/6000.7/script-reference/unity/uitoolkit/editor.md)
* **Assembly:** UnityEditor

## CreatePropertyGUI(SerializedProperty)

Creates the root element for the property GUI. This method is sealed.

```csharp
public override sealed VisualElement CreatePropertyGUI(SerializedProperty property)
```

### Parameters

**** (\[SerializedProperty]\(/engine/6000.7/script-reference/unityeditor/serializedproperty)): The property that represents the `UxmlSerializedData` instance.

### Returns

| Type                                                                                     | Description                         |
| ---------------------------------------------------------------------------------------- | ----------------------------------- |
| [VisualElement](/engine/6000.7/script-reference/unityengine/uielements/visualelement.md) | The root element for the Inspector. |

### Remarks

This method is sealed so the binding context stays in place. Override [UxmlSerializedDataPropertyDrawer.CreatePropertyGUI](/engine/6000.7/script-reference/unity/uitoolkit/editor/uxmlserializeddatapropertydrawer/createpropertygui.md), [UxmlSerializedDataPropertyDrawer.CreateChildPropertiesGUI](/engine/6000.7/script-reference/unity/uitoolkit/editor/uxmlserializeddatapropertydrawer/createchildpropertiesgui.md), or [UxmlSerializedDataPropertyDrawer.CreateChildPropertyGUI](/engine/6000.7/script-reference/unity/uitoolkit/editor/uxmlserializeddatapropertydrawer/createchildpropertygui.md) to customize the result.

## CreatePropertyGUI(VisualElement, SerializedProperty)

Creates the property GUI for a UXML serialized data instance.

```csharp
protected virtual void CreatePropertyGUI(VisualElement container, SerializedProperty property)
```

### Parameters

**** (\[VisualElement]\(/engine/6000.7/script-reference/unityengine/uielements/visualelement)): The parent element to add the content to.**** (\[SerializedProperty]\(/engine/6000.7/script-reference/unityeditor/serializedproperty)): The serialized property that represents the UXML serialized data instance.

### Remarks

The default implementation wraps the child properties in a [Foldout](/engine/6000.7/script-reference/unityengine/uielements/foldout.md) with the property display name as its label. Override this method to use a flat layout or a different container.

The following example replaces the default foldout with a flat layout.

### Examples

```csharp
// Override CreatePropertyGUI to replace the default Foldout with a flat layout.
[CustomPropertyDrawer(typeof(FlatButton.UxmlSerializedData))]
public class FlatButtonDrawer : UxmlSerializedDataPropertyDrawer
{
    protected override void CreatePropertyGUI(VisualElement container, SerializedProperty property)
    {
        VisualElement group = new VisualElement();
        container.Add(group);
        if (property.managedReferenceValue != null)
            CreateChildPropertiesGUI(group, property);
    }
}
```
