Class OptionalPropertyDrawer<T, TU>
Draws the Inspector GUI for an optional property
Inherited Members
Namespace: Unity.AppUI.Editor
Assembly: Unity.AppUI.Editor.dll
Syntax
public class OptionalPropertyDrawer<T, TU> : PropertyDrawer where TU : BindableElement, INotifyValueChanged<T>, new()
Type Parameters
Name | Description |
---|---|
T | The type of the optional property |
TU | The type of the field used to edit the value of the optional property |
Fields
m_HasValue
Whether the optional property has a value
Declaration
protected SerializedProperty m_HasValue
Field Value
Type | Description |
---|---|
SerializedProperty |
m_HasValueField
The toggle component used to edit the hasValue property
Declaration
protected Toggle m_HasValueField
Field Value
Type | Description |
---|---|
Toggle |
m_Value
The value of the optional property
Declaration
protected SerializedProperty m_Value
Field Value
Type | Description |
---|---|
SerializedProperty |
m_ValueField
The field component used to edit the value property
Declaration
protected TU m_ValueField
Field Value
Type | Description |
---|---|
TU |
Methods
CreatePropertyGUI(SerializedProperty)
Creates custom GUI with UI Toolkit for the property.
Declaration
public override VisualElement CreatePropertyGUI(SerializedProperty property)
Parameters
Type | Name | Description |
---|---|---|
SerializedProperty | property | The SerializedProperty to make the custom GUI for. |
Returns
Type | Description |
---|---|
VisualElement | The element containing the custom GUI. |
Overrides
SetValue(T)
Sets the value of the property in the serialized object
Declaration
protected virtual void SetValue(T newValue)
Parameters
Type | Name | Description |
---|---|---|
T | newValue | The new value of the property |