Added obsolete text to tooltip (only works, if another property attribute is present)

This commit is contained in:
Anders Ejlersen 2021-12-04 14:25:57 +01:00
parent 492b882a51
commit e4eb4dab47
2 changed files with 15 additions and 6 deletions

View file

@ -24,7 +24,6 @@ namespace Module.Inspector.Editor
bool prevEnabled = GUI.enabled;
GUI.enabled = accessType == EAccessType.Enabled;
// TODO: What to do with [Obsolete]?
if (result.draw != null)
{

View file

@ -126,12 +126,22 @@ namespace Module.Inspector.Editor.Utilities
}
}
if (!string.IsNullOrEmpty(obsoleteText))
if (isObsolete)
{
if (string.IsNullOrEmpty(obsoleteText))
{
if (tooltip != null)
tooltip += $"\n[Obsolete: {obsoleteText}";
tooltip += $"\n[Obsolete]";
else
tooltip = $"Obsolete: {obsoleteText}";
tooltip = $"[Obsolete]";
}
else
{
if (tooltip != null)
tooltip += $"\n[Obsolete: {obsoleteText}]";
else
tooltip = $"[Obsolete: {obsoleteText}]";
}
}
return new Result(drawer, predrawerModifiers, valueModifiers, accessModifiers, tooltip, isObsolete);