Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


UxmlSerializedDataPropertyDrawer

A base property drawer for UXML serialized data that renders attribute fields in the Inspector.
Read time 1 minuteLast updated 8 days ago

Definition

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

Remarks

Derive from UxmlSerializedDataPropertyDrawer and apply CustomPropertyDrawer 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 to control which attributes appear and in what order, and UxmlSerializedDataPropertyDrawer.CreateChildPropertyGUI to control how each one is drawn.
The following example defines a minimal drawer that uses the default field generation.

Examples

// 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

CreateChildPropertiesExcludingCreates a field for each visible attribute of the UXML serialized data, excluding the specified attributes.
CreateChildPropertiesGUICreates a field for each visible attribute of the UXML serialized data.
CreateChildPropertiesIncludingCreates a field only for the specified attributes of the UXML serialized data.
CreateChildPropertyGUICreates the GUI for a single attribute of the UXML serialized data.
CreatePropertyGUICreates the root element for the property GUI. This method is sealed.

Inheritance