StyledBannerDrawer.cs 714 B

123456789101112131415161718192021222324252627
  1. // Cristian Pop - https://boxophobic.com/
  2. using UnityEngine;
  3. using UnityEditor;
  4. namespace Boxophobic.StyledGUI
  5. {
  6. [CustomPropertyDrawer(typeof(StyledBanner))]
  7. public class StyledBannerAttributeDrawer : PropertyDrawer
  8. {
  9. StyledBanner a;
  10. public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
  11. {
  12. a = (StyledBanner)attribute;
  13. var bannerColor = new Color(a.colorR, a.colorG, a.colorB);
  14. StyledGUI.DrawInspectorBanner(bannerColor, a.title, a.helpURL);
  15. }
  16. public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
  17. {
  18. return -2;
  19. }
  20. }
  21. }