Fix TooltipAttribute not working and expose TriEditor.OnEnable and TriEditor.OnDisable (#144)

This commit is contained in:
Alexejhero 2023-11-06 06:26:30 +02:00 committed by GitHub
parent e825652e45
commit 7eb8291c31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 4 deletions

View File

@ -7,12 +7,12 @@ namespace TriInspector.Editors
{
private TriEditorCore _core;
private void OnEnable()
protected virtual void OnEnable()
{
_core = new TriEditorCore(this);
}
private void OnDisable()
protected virtual void OnDisable()
{
_core.Dispose();
}

View File

@ -6,9 +6,14 @@ namespace TriInspector.Elements
{
private readonly GUIContent _label;
public TriLabelElement(string label)
public TriLabelElement(string label, string tooltip = "")
{
_label = new GUIContent(label);
_label = new GUIContent(label, tooltip);
}
public TriLabelElement(GUIContent label)
{
_label = label;
}
public override float GetHeight(float width)

View File

@ -102,6 +102,10 @@ namespace TriInspector
{
CustomTooltip = ValueResolver.ResolveString(this, tooltipAttribute.Tooltip);
}
else if (Attributes.TryGet(out TooltipAttribute unityTooltipAttribute))
{
CustomTooltip = new ConstantValueResolver<string>(unityTooltipAttribute.tooltip);
}
}
public Type OwnerType { get; }