Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


CreatePropertyGUI

Creates the root element for the property GUI. This method is sealed.
Read time 1 minuteLast updated 13 days ago

Definition

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
UxmlSerializedData
instance.

Returns

Type

Description

VisualElementThe root element for the Inspector.

Remarks

CreatePropertyGUI(VisualElement, SerializedProperty)

Creates the property GUI for a UXML serialized data instance.
protected virtual void CreatePropertyGUI(VisualElement container, SerializedProperty property)

Parameters

container

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); }}