Skip to main content

Class SerializeReferenceIMGUIList

Namespace: Aspid.FastTools.SerializeReferences.Editors
Assembly: Aspid.FastTools.Editor.dll

Provides utility methods for drawing managed-reference lists with a type picker for new elements in IMGUI.

public static class SerializeReferenceIMGUIList

Inheritance​

object ← SerializeReferenceIMGUIList

Remarks​

The add button creates an independent instance in every selected object; element fields retain their registered property drawers. A [TypeSelector] on the list field adds its constraints to baseTypes.

Methods​

Draw(SerializedProperty, GUIContent, Type, params Type[])​

Draws a managed-reference list whose add button selects a type and appends an independent instance.

public static void Draw(SerializedProperty listProperty, GUIContent label, Type elementType, params Type[] baseTypes)

Parameters​

listProperty SerializedProperty

An array/list property whose elements are managed references.

label GUIContent

The list header; null uses the display name of listProperty, none displays no label.

elementType Type

The declared element type constraining the picker, supplied even when the list is empty.

baseTypes Type[]

Additional constraints below elementType; null or an empty array adds none.

Exceptions​

ArgumentNullException

listProperty is null.

ArgumentException

listProperty is not a managed-reference array.

Draw(SerializedProperty, GUIContent, Type[])​

Draws a managed-reference list whose add button selects a type and appends an independent instance, taking the element type from the field declaration.

public static void Draw(SerializedProperty listProperty, GUIContent label = null, Type[] baseTypes = null)

Parameters​

listProperty SerializedProperty

An array/list property whose elements are managed references.

label GUIContent

The list header; null uses the display name of listProperty, none displays no label.

baseTypes Type[]

Additional constraints below the element type; null or an empty array adds none.

Remarks​

When the list is empty and its field cannot be found by reflection, the element type falls back to Object; call the overload with elementType then.

Exceptions​

ArgumentNullException

listProperty is null.

ArgumentException

listProperty is not a managed-reference array.