From 6554165800aa323bbab5a626b0200d3337e53329 Mon Sep 17 00:00:00 2001 From: Govorunb Date: Mon, 6 Nov 2023 08:28:47 +1100 Subject: [PATCH] small fixes fix TriEditor's critical methods getting silently shadowed fix TooltipAttribute not being shown --- Editor/Editors/TriEditor.cs | 4 ++-- Editor/Elements/TriLabelElement.cs | 9 +++++++-- Editor/TriPropertyDefinition.cs | 4 ++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Editor/Editors/TriEditor.cs b/Editor/Editors/TriEditor.cs index f70718ad..e49a35ce 100644 --- a/Editor/Editors/TriEditor.cs +++ b/Editor/Editors/TriEditor.cs @@ -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(); } diff --git a/Editor/Elements/TriLabelElement.cs b/Editor/Elements/TriLabelElement.cs index eb0c1631..6c028c18 100644 --- a/Editor/Elements/TriLabelElement.cs +++ b/Editor/Elements/TriLabelElement.cs @@ -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) diff --git a/Editor/TriPropertyDefinition.cs b/Editor/TriPropertyDefinition.cs index 75cdcb0d..493a6bea 100644 --- a/Editor/TriPropertyDefinition.cs +++ b/Editor/TriPropertyDefinition.cs @@ -102,6 +102,10 @@ internal TriPropertyDefinition( { CustomTooltip = ValueResolver.ResolveString(this, tooltipAttribute.Tooltip); } + else if (Attributes.TryGet(out TooltipAttribute unityTooltipAttribute)) + { + CustomTooltip = new ConstantValueResolver(unityTooltipAttribute.tooltip); + } } public Type OwnerType { get; }