#if UNITY_EDITOR using UnityEditor; using UnityEngine; namespace DamageVolumeSystem.Editor { [CustomEditor(typeof(HealthData))] public class HealthDataEditor : UnityEditor.Editor { /* * Editor page created by Mountools * Author : WangSoul Team * Date : 2026 / 05 / 12 - 08:30:25 */ public HealthData healthData; private void OnEnable() { healthData = (HealthData) target; } private void DrawHealthDataEditor() { if (Application.isPlaying) { healthData.Health = EditorGUILayout.IntSlider($"Health ({(float) healthData.Health / healthData.maxHealth * 100}%)", healthData.Health, 0, healthData.maxHealth); } } #region _ public override void OnInspectorGUI() { Undo.RecordObject(healthData, "Edit HealthData"); EditorGUI.BeginChangeCheck(); DrawDefaultInspector(); DrawHealthDataEditor(); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(healthData); 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