Update inspector to be less annoying

This commit is contained in:
Michal Pikulski
2025-11-02 10:45:14 +01:00
parent 475464dccf
commit 5d6d4c8ba1
2 changed files with 391 additions and 100 deletions

View File

@@ -14,6 +14,9 @@ namespace Interactions
SerializedProperty characterArrivedProp; SerializedProperty characterArrivedProp;
SerializedProperty interactionCompleteProp; SerializedProperty interactionCompleteProp;
private bool showBaseSettings = true;
private bool showEvents = false;
private void OnEnable() private void OnEnable()
{ {
isOneTimeProp = serializedObject.FindProperty("isOneTime"); isOneTimeProp = serializedObject.FindProperty("isOneTime");
@@ -29,13 +32,29 @@ namespace Interactions
{ {
serializedObject.Update(); serializedObject.Update();
EditorGUILayout.LabelField("Interaction Settings", EditorStyles.boldLabel); // Draw child-specific properties first (anything not part of base class)
DrawPropertiesExcluding(serializedObject,
"m_Script",
"isOneTime",
"cooldown",
"characterToInteract",
"interactionStarted",
"interactionInterrupted",
"characterArrived",
"interactionComplete");
// Base Interaction Settings (Collapsible)
EditorGUILayout.Space(10);
showBaseSettings = EditorGUILayout.Foldout(showBaseSettings, "Base Interaction Settings", true, EditorStyles.foldoutHeader);
if (showBaseSettings)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(isOneTimeProp); EditorGUILayout.PropertyField(isOneTimeProp);
EditorGUILayout.PropertyField(cooldownProp); EditorGUILayout.PropertyField(cooldownProp);
EditorGUILayout.PropertyField(characterToInteractProp); EditorGUILayout.PropertyField(characterToInteractProp);
// Add the buttons for creating move targets // Character Move Targets (sub-section)
EditorGUILayout.Space(10); EditorGUILayout.Space(5);
EditorGUILayout.LabelField("Character Move Targets", EditorStyles.boldLabel); EditorGUILayout.LabelField("Character Move Targets", EditorStyles.boldLabel);
EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginHorizontal();
@@ -80,12 +99,22 @@ namespace Interactions
EditorGUILayout.HelpBox("Warning: Multiple move targets found that may conflict. Priority order: Both > Character-specific targets.", MessageType.Warning); EditorGUILayout.HelpBox("Warning: Multiple move targets found that may conflict. Priority order: Both > Character-specific targets.", MessageType.Warning);
} }
EditorGUI.indentLevel--;
}
// Interaction Events (Collapsible)
EditorGUILayout.Space(10); EditorGUILayout.Space(10);
EditorGUILayout.LabelField("Interaction Events", EditorStyles.boldLabel); showEvents = EditorGUILayout.Foldout(showEvents, "Interaction Events", true, EditorStyles.foldoutHeader);
if (showEvents)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(interactionStartedProp); EditorGUILayout.PropertyField(interactionStartedProp);
EditorGUILayout.PropertyField(interactionInterruptedProp); EditorGUILayout.PropertyField(interactionInterruptedProp);
EditorGUILayout.PropertyField(characterArrivedProp); EditorGUILayout.PropertyField(characterArrivedProp);
EditorGUILayout.PropertyField(interactionCompleteProp); EditorGUILayout.PropertyField(interactionCompleteProp);
EditorGUI.indentLevel--;
}
serializedObject.ApplyModifiedProperties(); serializedObject.ApplyModifiedProperties();
} }

File diff suppressed because one or more lines are too long