ScreenFaderDrawer.cs 776 B

12345678910111213141516171819202122
  1. using UnityEditor;
  2. using UnityEngine;
  3. using UnityEngine.Playables;
  4. using UnityEngine.UI;
  5. [CustomPropertyDrawer(typeof(ScreenFaderBehaviour))]
  6. public class ScreenFaderDrawer : PropertyDrawer
  7. {
  8. public override float GetPropertyHeight (SerializedProperty property, GUIContent label)
  9. {
  10. int fieldCount = 1;
  11. return fieldCount * EditorGUIUtility.singleLineHeight;
  12. }
  13. public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
  14. {
  15. SerializedProperty colorProp = property.FindPropertyRelative("color");
  16. Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
  17. EditorGUI.PropertyField(singleFieldRect, colorProp);
  18. }
  19. }