using UnityEngine; using UnityEditor; using AppleHills.Editor; using AppleHills.Core.Settings; namespace PuzzleS.Editor { [CustomEditor(typeof(ObjectiveStepBehaviour))] public class ObjectiveStepBehaviourEditor : UnityEditor.Editor { private SerializedProperty stepDataProperty; private SerializedProperty indicatorPrefabProperty; private SerializedProperty drawPromptRangeGizmoProperty; private void OnEnable() { stepDataProperty = serializedObject.FindProperty("stepData"); indicatorPrefabProperty = serializedObject.FindProperty("indicatorPrefab"); drawPromptRangeGizmoProperty = serializedObject.FindProperty("drawPromptRangeGizmo"); } public override void OnInspectorGUI() { serializedObject.Update(); // Draw default inspector properties EditorGUILayout.PropertyField(stepDataProperty); EditorGUILayout.Space(); EditorGUILayout.LabelField("Indicator Settings", EditorStyles.boldLabel); EditorGUILayout.PropertyField(indicatorPrefabProperty); EditorGUILayout.PropertyField(drawPromptRangeGizmoProperty); // Add button to create default indicator EditorGUILayout.Space(); if (GUILayout.Button("Create Default Indicator")) { var interactionSettings = EditorSettingsProvider.GetSettings(); if (interactionSettings != null && interactionSettings.DefaultPuzzleIndicatorPrefab != null) { indicatorPrefabProperty.objectReferenceValue = interactionSettings.DefaultPuzzleIndicatorPrefab; serializedObject.ApplyModifiedProperties(); Debug.Log("Default puzzle indicator prefab assigned from settings"); } else { Debug.LogWarning("Default puzzle indicator prefab not set in InteractionSettings!"); EditorUtility.DisplayDialog("No Default Indicator", "The default puzzle indicator prefab is not set in the InteractionSettings asset.", "OK"); } } serializedObject.ApplyModifiedProperties(); } } }