Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. using UnityEngine;
  2. #if UNITY_EDITOR
  3. using UnityEditor;
  4. #endif
  5.  
  6. class ShapePropertyNameAttribute : PropertyAttribute
  7. {
  8. #if UNITY_EDITOR
  9. [CustomPropertyDrawer(typeof(ShapePropertyNameAttribute))]
  10. class FieldNameDrawer : PropertyDrawer
  11. {
  12. public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
  13. {
  14. string propertyName = property.name;
  15. if (attribute is ShapePropertyNameAttribute && propertyName.EndsWith("k__BackingField"))
  16. label.text = propertyName.Substring(1, propertyName.IndexOf(">") - 1);
  17.  
  18. EditorGUI.PropertyField(position, property, label, true);
  19. }
  20. }
  21. #endif
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement