StyledCategoryDrawer.cs 804 B

12345678910111213141516171819202122232425262728293031
  1. // Cristian Pop - https://boxophobic.com/
  2. using UnityEngine;
  3. using UnityEditor;
  4. using Boxophobic.Constants;
  5. namespace Boxophobic.StyledGUI
  6. {
  7. [CustomPropertyDrawer(typeof(StyledCategory))]
  8. public class StyledCategoryAttributeDrawer : PropertyDrawer
  9. {
  10. StyledCategory a;
  11. public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
  12. {
  13. a = (StyledCategory)attribute;
  14. GUI.enabled = true;
  15. EditorGUI.indentLevel = 0;
  16. GUILayout.Space(a.top);
  17. StyledGUI.DrawInspectorCategory(a.category);
  18. GUILayout.Space(a.down);
  19. }
  20. public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
  21. {
  22. return -2;
  23. }
  24. }
  25. }