Files
FueraDeEscala/Assets/Game Kit Controller/Scripts/Editor/CustomizableToolbarSettingsInspector.cs
Robii Aragon fd87a6ffd5 add ckg
plantilla base para movimiento básico
2026-02-05 05:07:55 -08:00

56 lines
1.4 KiB
C#

using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
[CustomEditor (typeof(CustomizableToolbarSettings))]
public class CustomizableToolbarSettingsInspector : Editor
{
private SerializedProperty m_property;
private ReorderableList m_reorderableList;
SerializedProperty numberOfColumns;
SerializedProperty windowsHeight;
void OnEnable ()
{
m_property = serializedObject.FindProperty ("m_list");
m_reorderableList = new ReorderableList (serializedObject, m_property) {
elementHeight = 120,
drawElementCallback = OnDrawElement
};
numberOfColumns = serializedObject.FindProperty ("numberOfColumns");
windowsHeight = serializedObject.FindProperty ("windowsHeight");
}
private void OnDrawElement (Rect rect, int index, bool isActive, bool isFocused)
{
var element = m_property.GetArrayElementAtIndex (index);
rect.height -= 4;
rect.y += 2;
EditorGUI.PropertyField (rect, element);
}
public override void OnInspectorGUI ()
{
serializedObject.Update ();
EditorGUILayout.PropertyField (numberOfColumns);
EditorGUILayout.PropertyField (windowsHeight);
EditorGUILayout.Space ();
if (GUILayout.Button (new GUIContent ("Update Values"))) {
CustomizableToolbar.updateToolBarValues ();
}
EditorGUILayout.Space ();
EditorGUILayout.Space ();
m_reorderableList.DoLayoutList ();
serializedObject.ApplyModifiedProperties ();
}
}