Tri-Inspector/Editor.Extras/Drawers/LabelWidthDrawer.cs

21 lines
625 B
C#
Raw Normal View History

2021-12-07 10:20:36 -05:00
using TriInspector;
using TriInspector.Drawers;
using UnityEditor;
using UnityEngine;
2022-01-06 12:11:27 -05:00
[assembly: RegisterTriAttributeDrawer(typeof(LabelWidthDrawer), TriDrawerOrder.Decorator)]
2021-12-07 10:20:36 -05:00
namespace TriInspector.Drawers
{
public class LabelWidthDrawer : TriAttributeDrawer<LabelWidthAttribute>
{
public override void OnGUI(Rect position, TriProperty property, TriElement next)
{
var oldLabelWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = Attribute.Width;
next.OnGUI(position);
EditorGUIUtility.labelWidth = oldLabelWidth;
}
}
}