Skip to content

Commit

Permalink
Fix TooltipAttribute not working and expose TriEditor.OnEnable and Tr…
Browse files Browse the repository at this point in the history
…iEditor.OnDisable (#144)
  • Loading branch information
Alexejhero authored Nov 6, 2023
1 parent e825652 commit 7eb8291
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Editor/Editors/TriEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ public abstract class TriEditor : Editor
{
private TriEditorCore _core;

private void OnEnable()
protected virtual void OnEnable()
{
_core = new TriEditorCore(this);
}

private void OnDisable()
protected virtual void OnDisable()
{
_core.Dispose();
}
Expand Down
9 changes: 7 additions & 2 deletions Editor/Elements/TriLabelElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ public class TriLabelElement : TriElement
{
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)
Expand Down
4 changes: 4 additions & 0 deletions Editor/TriPropertyDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ internal TriPropertyDefinition(
{
CustomTooltip = ValueResolver.ResolveString(this, tooltipAttribute.Tooltip);
}
else if (Attributes.TryGet(out TooltipAttribute unityTooltipAttribute))
{
CustomTooltip = new ConstantValueResolver<string>(unityTooltipAttribute.tooltip);
}
}

public Type OwnerType { get; }
Expand Down

0 comments on commit 7eb8291

Please sign in to comment.