Click or drag to resize
Customize appearance of list field

Style of list container, add button and remove buttons can be customized by providing custom styles. This example demonstrates a custom inspector with custom styles which are based upon the default styles.

Tip Tip

Another option is to subclass ReorderableListControl and initialise custom styles there instead. A subclass can override other behaviour such as providing custom context menu items.

using Rotorz.ReorderableList;
using UnityEditor;
using UnityEngine;

[CustomEditor(typeof(SomeBehaviour))]
class SomeBehaviourEditor : Editor {

    // Custom instance of reorderable list control.
    private ReorderableListControl _listControl;
    // Serialized property adaptor for wishlist.
    private SerializedListAdaptor _wishlistAdaptor;

    void OnEnable() {
        // Prepare custom styles as needed.
        var style = new GUIStyle(ReorderableListStyles.Container);
        style.normal.background = AssetDatabase.LoadAssetAtPath("Assets/custom_container.png") as Texture2D;

        // Assign custom style to instance of list control.
        _listControl = new ReorderableListControl();
        _listControl.ContainerStyle = style;

        // Create adaptor for wishlist using serialized property.
        var wishlist = serializedObject.FindProperty("wishlist");
        _wishlistAdaptor = new SerializedListAdaptor(wishlist);
    }

    public override void OnInspectorGUI() {
        _listControl.Draw(_wishlistAdaptor);
    }

}