CreatePropertyGUI
Creates the root element for the property GUI. This method is sealed.
Read time 1 minuteLast updated 13 days ago
Definition
- Type: Method
- Namespace: Unity.UIToolkit.Editor
- Assembly: UnityEditor
CreatePropertyGUI(SerializedProperty)
Creates the root element for the property GUI. This method is sealed.
public override sealed VisualElement CreatePropertyGUI(SerializedProperty property)
Parameters
The property that represents the instance.
UxmlSerializedDataReturns
Type | Description |
|---|---|
| VisualElement | The root element for the Inspector. |
Remarks
This method is sealed so the binding context stays in place. Override UxmlSerializedDataPropertyDrawer.CreatePropertyGUI, UxmlSerializedDataPropertyDrawer.CreateChildPropertiesGUI, or UxmlSerializedDataPropertyDrawer.CreateChildPropertyGUI to customize the result.
CreatePropertyGUI(VisualElement, SerializedProperty)
Creates the property GUI for a UXML serialized data instance.
protected virtual void CreatePropertyGUI(VisualElement container, SerializedProperty property)
Parameters
The parent element to add the content to.
The serialized property that represents the UXML serialized data instance.
Remarks
The default implementation wraps the child properties in a Foldout 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
// 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); }}