private static GUIContent
moveButtonContent =
new
GUIContent(
"u21b4"
,
"move down"
),
duplicateButtonContent =
new
GUIContent(
"+"
,
"duplicate"
),
deleteButtonContent =
new
GUIContent(
"-"
,
"delete"
),
addButtonContent =
new
GUIContent(
"+"
,
"add element"
);
private static void ShowElements (SerializedProperty list, EditorListOption options) {
bool
showElementLabels = (options & EditorListOption.ElementLabels) != 0,
showButtons = (options & EditorListOption.Buttons) != 0;
for
(int i = 0; i < list.arraySize; i++) {
if
(showButtons) {
EditorGUILayout.BeginHorizontal();
}
if
(showElementLabels) {
EditorGUILayout.PropertyField(list.GetArrayElementAtIndex(i));
}
else
{
EditorGUILayout.PropertyField(list.GetArrayElementAtIndex(i), GUIContent.none);
}
if
(showButtons) {
ShowButtons(list, i);
EditorGUILayout.EndHorizontal();
}
}
if
(showButtons && list.arraySize == 0 && GUILayout.Button(addButtonContent, EditorStyles.miniButton)) {
list.arraySize += 1;
}
}