Click or drag to resize
ReorderableListControlItemDrawerT Delegate
Invoked to draw list item.

Namespace: Rotorz.ReorderableList
Assembly: Editor.ReorderableList (in Editor.ReorderableList.dll) Version: 0.0.0.0 (0.3.0.0)
Syntax
public delegate T ItemDrawer<T>(
	Rect position,
	T item
)

Parameters

position
Type: Rect
Position of list item.
item
Type: T
The list item.

Type Parameters

T
Type of item list.

Return Value

Type: T
The modified value.
Remarks

GUI controls must be positioned absolutely within the given rectangle since list items must be sized consistently.

Examples

The following listing presents a text field for each list item:

using Rotorz.ReorderableList;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

public class ExampleWindow : EditorWindow {
    public List<string> wishlist = new List<string>();

    private void OnGUI() {
        ReorderableListGUI.ListField(wishlist, DrawListItem);
    }

    private string DrawListItem(Rect position, string value) {
        // Text fields do not like `null` values!
        if (value == null)
            value = "";
        return EditorGUI.TextField(position, value);
    }
}
See Also