Перейти к основному содержимому

Class EditorExtensions

Namespace: Aspid.FastTools.Editors
Assembly: Aspid.FastTools.Editor.dll

Provides extension methods for resolving Unity object display names.

public static class EditorExtensions

Inheritance​

object ← EditorExtensions

Methods​

GetDisplayName(Object)​

Returns the last segment of the AddComponentMenu path declared on the object's own type, or the nicified type name.

public static string GetDisplayName(this Object obj)

Parameters​

obj Object

The object whose display name to resolve.

Returns​

string

The display name; otherwise, Empty if obj is null or destroyed.

Remarks​

An attribute inherited from a base class, an empty path or a path ending with / falls back to the type name. Unlike GetInspectorTitle, the result never carries the (Script) or (Deprecated) suffix.

GetDisplayNameWithIndex(Component)​

Returns the component display name with a one-based suffix when its object has multiple components of the exact same type.

public static string GetDisplayNameWithIndex(this Component targetComponent)

Parameters​

targetComponent Component

The component whose indexed display name to resolve.

Returns​

string

The display name, indexed in component order when duplicates exist; otherwise, Empty if targetComponent is null or destroyed.