Reorderable List
Drag items into a new order or transfer them between lists
Overview
Reorderable List lets users rearrange UI items by dragging.
Usage
Add Reorderable List to a UI container and assign List Container.
Populate the container and call RefreshItemsList() when adding children directly.
Configure the drag scale, opacity, and rearrangement animation.
Customization
Transfers
Enable Allow List Transfer on participating lists and give them the same Transfer Group. They must share a root Canvas. Assign Drop Area to a viewport when the visible drop target differs from the list container. onListChanged reports the item, source list, and destination list.
Layout
An attached layout group controls spacing; Item Spacing is used when no layout group is attached. Instant Snap skips the rearrangement animation.
Public API
Use ReorderableList in the Evo.UI namespace.
Call CancelDrag() before changing the hierarchy during a drag. DetachItem() removes an item from list management without destroying its GameObject.
Properties
| Name | Type | Description |
|---|---|---|
IsDraggingActive | bool | Whether an item is being dragged. |
IsAnimating | bool | Whether rearrangement is animating. |
Fields
| Name | Type | Description |
|---|---|---|
allowListTransfer | bool | Enables transfer between compatible lists. |
transferGroup | string | Group name shared by lists that may exchange items. |
dropArea | RectTransform | Optional drop target rectangle. |
Methods
| Name | Parameters | Description |
|---|---|---|
Items() | None | Returns tracked ReorderableListItem entries. Returns List<ReorderableListItem>. |
AddExistingItem() | RectTransform item | Registers an existing RectTransform as a list item. |
AddExistingItem() | GameObject item | Registers an existing GameObject as a list item. |
RemoveItem() | ReorderableListItem item | Removes an item and destroys its GameObject. |
RemoveItem() | GameObject itemGo | Removes an item and destroys its GameObject. |
DetachItem() | RectTransform itemRect | Stops managing a RectTransform without deleting it. |
ClearItems() | None | Clears the list and destroys its item GameObjects. |
RefreshItemsList() | None | Collects items after hierarchy changes. |
RefreshLayout() | None | Updates item positions. |
CancelDrag() | None | Cancels the current drag. |
Events
| Name | Type | Description |
|---|---|---|
onOrderChanged | UnityEvent<ReorderableListItem, int, int> | Item, previous index, and new index. |
onListChanged | UnityEvent<ReorderableListItem, ReorderableList, ReorderableList> | Item, source list, and destination list. |
Example
using UnityEngine;
using Evo.UI;
public class ReorderableListExample : MonoBehaviour
{
[SerializeField] private ReorderableList target;
private void Start()
{
target.allowListTransfer = true;
target.transferGroup = "Inventory";
target.RefreshItemsList();
target.onOrderChanged.AddListener((item, before, after) =>
Debug.Log($"Moved {before} to {after}"));
}
}