Skip to main content

Editor Helpers

Readable object labels for your own editor windows — without “(Script)”, and numbered for identical components.

Quick start​

Before — Unity APIAfter — FastTools
new Label(ObjectNames
.GetInspectorTitle(caster));
new Label(caster
.GetDisplayNameWithIndex());

GetDisplayName()​

Works on any UnityEngine.Object; a null or destroyed object returns string.Empty.

[AddComponentMenu]GetInspectorTitle()GetDisplayName()
noneAbility Caster (Script)Ability Caster
"Gameplay/Ability" on AbilityCasterAbilityAbility
"Gameplay/Ability" on a base classAbility Caster (Script)Ability Caster

GetDisplayNameWithIndex()​

Works on Component. The number is the position among components of the same type on the GameObject; a null or destroyed component returns string.Empty.

Components on the GameObjectLabels
AbilityCasterAbility Caster
AbilityCaster, AbilityCasterAbility Caster (1), Ability Caster (2)
AbilityCaster, class FireCaster : AbilityCasterAbility Caster, Fire Caster

Package sample​

In EditorTools, GetDisplayName() titles the custom inspector of the AbilityConfig asset.