Delegate ReorderableListControl.DrawEmpty
Invoked to draw content for empty list.
Namespace: Unity.VisualScripting.ReorderableList
Syntax
public delegate void DrawEmpty();
Remarks
Callback should make use of GUILayout
to present controls.
Examples
The following listing displays a label for empty list control:
using Unity.VisualScripting.Dependencies.ReorderableList;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class ExampleWindow : EditorWindow {
private List<string> _list;
private void OnEnable() {
_list = new List<string>();
}
private void OnGUI() {
ReorderableListGUI.ListField(_list, ReorderableListGUI.TextFieldItemDrawer, DrawEmptyMessage);
}
private string DrawEmptyMessage() {
GUILayout.Label("List is empty!", EditorStyles.miniLabel);
}
}
import Rotorz.ReorderableList;
import System.Collections.Generic;
class ExampleWindow extends EditorWindow {
private var _list:List.<String>;
function OnEnable() {
_list = new List.<String>();
}
function OnGUI() {
ReorderableListGUI.ListField(_list, ReorderableListGUI.TextFieldItemDrawer, DrawEmptyMessage);
}
function DrawEmptyMessage() {
GUILayout.Label('List is empty!', EditorStyles.miniLabel);
}
}