Generic list inside editor window |
Items from generic lists can be presented using custom item drawers. A custom item drawer is essentially a delegate which is called to draw each list item. The generic list adaptor can be subclassed instead if items of varying heights are needed (see Custom list adaptor).
![]() |
---|
Consider using serialized properties instead if undo/redo support is needed. |
using Rotorz.ReorderableList; using System.Collections.Generic; using UnityEditor; using UnityEngine; public class GenericListWindow : EditorWindow { private List<string> _nameList; void OnEnable() { _nameList = new List<string>(); } void OnGUI() { ReorderableListGUI.ListField(_nameList, DrawListItem); } string DrawListItem(Rect position, string value) { // Text fields do not like null values! if (value == null) value = ""; return EditorGUI.TextField(position, value); } }