[ReorderableList]

Displays an array or list as a reorderable list with drag-and-drop support.

Support Types

Type
Description

T[]

Array of elements

List<T>

List of elements

Parameters

Parameter Name
Arguments
Description

HeaderHeight

float

Height of the header.

Draggable

bool

Elements is draggable?

ShowAddButton

bool

Show add element button?

ShowRemoveButton

bool

Show remove element button?

OnHeaderGUI

void OnHeaderGUI(Rect position)

Called to draw header GUI.

OnElementGUI

void OnElementGUI(Rect position, SerializedProperty element, GUIContent label)

Called to draw list element GUI.

OnNoneElementGUI

void OnNoneElementGUI(Rect position)

Called when list is empty.

GetElementHeight

float GetElementHeight(SerializedProperty element)

Called to calculate list element height.

OnAddElement

void OnAddElement(SerializedProperty array)

Called when added new element to list.

OnAddDropdownElement

void OnDropdownAddElement(Rect position, SerializedProperty list)

Called when added new element to list through dropdown menu.

OnRemoveElement

void OnRemoveElement(SerializedProperty array)

Called when removed element from list.

GetElementLabel

GUIContent GetElementLabel(SerializedProperty array, int index)

Called to draw element label.

Examples

using System.Collections.Generic;
using UnityEngine;
using RenownedGames.Apex;

public class ReorderableListExample : MonoBehaviour
{
    [ReorderableList]
    public List<string> stringList;

    [ReorderableList(ShowAddButton = false, Draggable = false)]
    public int[] fixedList;

    [ReorderableList(OnHeaderGUI = "DrawHeader")]
    public List<float> customHeaderList;

    private void DrawHeader(Rect position)
    {
        EditorGUI.LabelField(position, "My Custom Header");
    }
}

Last updated