Skip to main content

Editor Helpers

Object labels without “(Script)” and numbering for components of the same type.

Quick start​

Before — Unity APIAfter — FastTools
ObjectNames.GetInspectorTitle(caster)caster.GetDisplayName()
Ability Caster (Script)Ability Caster

GetDisplayName()​

Returns a readable type name for any UnityEngine.Object, rather than the value of Object.name.

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

GetDisplayNameWithIndex()​

Adds a number when a GameObject has multiple components of the same type. Numbering starts at 1 and follows component order.

Components on the GameObjectLabels
AbilityCasterAbility Caster
AbilityCaster, AbilityCasterAbility Caster (1), Ability Caster (2)
AbilityCaster and its subclass FireCasterAbility Caster, Fire Caster

Both methods return string.Empty for a null or destroyed object.

Package sample​

In EditorTools, GetDisplayName() names the AbilityConfig script in the tooltip of the ability title.

The Ability Catalog window from the EditorTools sampleThe Ability Catalog window from the EditorTools sample