#if UNITY_EDITOR using UnityEditor; using UnityEngine; namespace DamageVolumeSystem.Editor { [CustomEditor(typeof(DamageGenerator))] public class DamageGeneratorEditor : UnityEditor.Editor { /* * Editor page created by Mountools * Author : WangSoul Team * Date : 2026 / 05 / 09 - 16:20:21 */ public DamageGenerator damageGenerator; private void OnEnable() { damageGenerator = (DamageGenerator) target; } private void DrawDamageGeneratorEditor() { if (GUILayout.Button("生成伤害")) { damageGenerator.Emit(); } } #region _ public override void OnInspectorGUI() { Undo.RecordObject(damageGenerator, "Edit DamageGenerator"); EditorGUI.BeginChangeCheck(); DrawDefaultInspector(); DrawDamageGeneratorEditor(); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(damageGenerator); Undo.FlushUndoRecordObjects(); serializedObject.ApplyModifiedProperties(); } } private bool Property(string label, string propertyName, params GUILayoutOption[] options) { return EditorGUILayout.PropertyField(serializedObject.FindProperty(propertyName), new GUIContent(label), options); } #endregion } } #endif