mirror of
https://github.com/codewriter-packages/Tri-Inspector.git
synced 2025-01-22 00:08:51 -05:00
29 lines
645 B
C#
29 lines
645 B
C#
using UnityEngine;
|
|
|
|
namespace TriInspector.Elements
|
|
{
|
|
public class TriLabelElement : TriElement
|
|
{
|
|
private readonly GUIContent _label;
|
|
|
|
public TriLabelElement(string label, string tooltip = "")
|
|
{
|
|
_label = new GUIContent(label, tooltip);
|
|
}
|
|
|
|
public TriLabelElement(GUIContent label)
|
|
{
|
|
_label = label;
|
|
}
|
|
|
|
public override float GetHeight(float width)
|
|
{
|
|
return GUI.skin.label.CalcHeight(_label, width);
|
|
}
|
|
|
|
public override void OnGUI(Rect position)
|
|
{
|
|
GUI.Label(position, _label);
|
|
}
|
|
}
|
|
} |