using UnityEditor; using UnityEngine; using Minigames.DivingForPictures; /// /// Custom editor for TrenchTileSpawner that adds a runtime button to test the StartSurfacing function /// [CustomEditor(typeof(TrenchTileSpawner))] public class TrenchTileSpawnerEditor : UnityEditor.Editor { public override void OnInspectorGUI() { // Draw the default inspector DrawDefaultInspector(); // Get the target TrenchTileSpawner TrenchTileSpawner spawner = (TrenchTileSpawner)target; // Add space between default inspector and custom button EditorGUILayout.Space(10); // Separator line EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); // Add a label for the runtime testing section EditorGUILayout.LabelField("Runtime Testing", EditorStyles.boldLabel); // Only enable the button during play mode EditorGUI.BeginDisabledGroup(!Application.isPlaying); // Add the button to call StartSurfacing if (GUILayout.Button("Start Surfacing", GUILayout.Height(30))) { spawner.StartSurfacing(); } EditorGUI.EndDisabledGroup(); // Add explanatory text EditorGUILayout.HelpBox("This button will reverse the direction of the trench movement, making the player surface instead of descend. Only works in Play Mode.", MessageType.Info); } }