12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using Routes;
- using UnityEditor;
- using UnityEngine;
- using UnityEngine.UIElements;
- public static class RouteDrawer
- {
- private static bool showListContent = true;
- public static void PropertyField(SerializedProperty route)
- {
- Debug.Log("route = "+route);
- ListField(route.FindPropertyRelative("items"));
- }
- private static void ListField(SerializedProperty list)
- {
-
- showListContent = EditorGUILayout.Foldout(showListContent, $"{list.displayName} (Length = {0})");
- EditorGUILayout.EndHorizontal();
-
- if (showListContent) {
- EditorGUI.indentLevel += 1;
- for (var i = 0; i < list.arraySize; i++) {
- EditorGUILayout.BeginHorizontal();
- EditorGUILayout.PropertyField(list.GetArrayElementAtIndex(i));
- if (GUILayout.Button("-", EditorStyles.miniButton, GUILayout.Width(32)))
- {
- list.DeleteArrayElementAtIndex(i);
- }
- EditorGUILayout.EndHorizontal();
- }
- EditorGUI.indentLevel -= 1;
- }
-
-
-
-
- }
- }
|