LuxURPHelpDrawer.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEditor;
  4. public class LuxURPHelpDrawer : MaterialPropertyDrawer
  5. {
  6. public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
  7. {
  8. float brightness = 1.45f;
  9. if (!EditorGUIUtility.isProSkin) {
  10. brightness = 1.0f;
  11. }
  12. Color HelpCol = new Color(0.32f * brightness, 0.50f * brightness, 1.0f * brightness, 1.0f * brightness);
  13. //GUIStyle hStyle = GUI.skin.GetStyle("HelpBox");
  14. GUIStyle hStyle = GUI.skin.GetStyle("MiniLabel");
  15. hStyle.wordWrap = true;
  16. hStyle.normal.textColor = HelpCol;
  17. hStyle.padding = new RectOffset(18, 0, 1, 3);
  18. #if UNITY_2019_3_OR_NEWER
  19. if (!EditorGUIUtility.isProSkin) {
  20. brightness = 1.0f;
  21. HelpCol = new Color(0.11f * brightness, 0.45f * brightness, 0.58f * brightness, 1.0f);
  22. }
  23. else {
  24. brightness = 3.25f;
  25. HelpCol = new Color(0.35f * brightness, 0.30f * brightness, 1.0f * brightness, 1.0f * brightness);
  26. }
  27. hStyle.padding = new RectOffset(16, 0, 1, 3);
  28. #endif
  29. Color col = GUI.contentColor;
  30. Color colbg = GUI.backgroundColor;
  31. GUI.contentColor = HelpCol;
  32. GUI.backgroundColor = Color.clear;
  33. GUILayout.Space(-4);
  34. EditorGUILayout.TextArea(label, hStyle);
  35. GUI.contentColor = col;
  36. GUI.backgroundColor = colbg;
  37. }
  38. public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
  39. {
  40. return base.GetPropertyHeight(prop, label, editor) * 0.0f;
  41. }
  42. }