StyledIndentDrawer.cs 612 B

12345678910111213141516171819202122232425
  1. // Cristian Pop - https://boxophobic.com/
  2. using UnityEngine;
  3. using UnityEditor;
  4. namespace Boxophobic.StyledGUI
  5. {
  6. [CustomPropertyDrawer(typeof(StyledIndent))]
  7. public class StyledIndentAttributeDrawer : PropertyDrawer
  8. {
  9. StyledIndent a;
  10. public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
  11. {
  12. a = (StyledIndent)attribute;
  13. EditorGUI.indentLevel = a.indent;
  14. }
  15. public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
  16. {
  17. return -2;
  18. }
  19. }
  20. }