Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- #if UNITY_EDITOR
- using UnityEditor;
- #endif
- class ShapePropertyNameAttribute : PropertyAttribute
- {
- #if UNITY_EDITOR
- [CustomPropertyDrawer(typeof(ShapePropertyNameAttribute))]
- class FieldNameDrawer : PropertyDrawer
- {
- public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
- {
- string propertyName = property.name;
- if (attribute is ShapePropertyNameAttribute && propertyName.EndsWith("k__BackingField"))
- label.text = propertyName.Substring(1, propertyName.IndexOf(">") - 1);
- EditorGUI.PropertyField(position, property, label, true);
- }
- }
- #endif
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement