Files
trail-into-darkness/Packages/com.jovian.inspector/Editor/Attributes/OverrideLabelAttribute.cs
2026-03-29 18:59:24 +02:00

28 lines
640 B
C#

using UnityEngine;
namespace InspectorToolkit
{
public class OverrideLabelAttribute : PropertyAttribute
{
public readonly string NewLabel;
public OverrideLabelAttribute(string newLabel) => NewLabel = newLabel;
}
}
#if UNITY_EDITOR
namespace InspectorToolkit.Internal
{
using UnityEditor;
[CustomPropertyDrawer(typeof(OverrideLabelAttribute))]
public class OverrideLabelDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
label.text = ((OverrideLabelAttribute)attribute).NewLabel;
EditorGUI.PropertyField(position, property, label);
}
}
}
#endif