Adding reorderable lists to editor interfaces in Unity

Often I find myself in need of reorderable list functionality in my various custom editor interfaces, and so I decided to create a generalized implementation which works with generic lists List<T> and with SerializedProperty.

Screenshot of a reorderable list control

This list control provides drag and drop reordering and supports mixed item heights when using custom property drawers. It is generally better to present lists for serialized properties since Unity provides automatic undo/redo support for these. You can also implement your very own list adapter to present entirely custom lists.

This control is provided as open source under the MIT license and can be downloaded from the following repository: https://bitbucket.org/rotorz/reorderable-list-editor-field-for-unity/overview

Here is the custom editor which is used in the above screenshot:

SerializedProperty shoppingListProperty;
SerializedProperty purchasedListProperty;
 
private void OnEnable()
{
    this.shoppingListProperty = this.serializedObject.FindProperty("shoppingList");
    this.purchasedListProperty = this.serializedObject.FindProperty("purchasedList");
}
 
public override void OnInspectorGUI()
{
    this.serializedObject.Update();
 
    ReorderableListGUI.Title("Shopping List");
    ReorderableListGUI.ListField(this.shoppingListProperty);
 
    ReorderableListGUI.Title("Purchased Items");
    ReorderableListGUI.ListField(this.purchasedListProperty,
        ReorderableListFlags.DisableReordering
      | ReorderableListFlags.HideAddButton
    );
 
    this.serializedObject.ApplyModifiedProperties();
}