Odin ignores InspectorName attribute

Issue #649 resolved
Daniel Filipe created an issue

Unity allows changing the display name of enum values via the InspectorName attribute: https://docs.unity3d.com/2019.3/Documentation/ScriptReference/InspectorNameAttribute.html

In Unity, the values are displayed like so:

public enum MyEnum
{
    [InspectorName("Test A")]
    A,
    [InspectorName("Test B")]
    B
}

But with Odin, it always uses the enum names:

Unity 2019.3.7f1
Odin Inspector 2.1.11

Comments (7)

  1. Tor Esa Vestergaard

    Hm. Currently you can use [LabelText] to do the same in Odin, but we can add support for this attribute to Odin’s enum selector as well. Thanks for the heads-up, didn’t know about this.

  2. Daniel Filipe reporter

    @Tor Esa Vestergaard LabelText seems to have some bugs when applied to enums. The selected value still shows the enum name (not the label text), and the first enum value still shows up on the dropdown. Example:

    public enum CondType
    {
        [LabelText("==")]
        Equals,
        [LabelText(">=")]
        EqOrMore,
        [LabelText("<=")]
        EqOrLess,
        [LabelText(">")]
        More,
        [LabelText("<")]
        Less,
        [LabelText("!=")]
        NotEquals
    }
    

    Shows up as:

    I would expect “==” to show up instead of “Equals” (both in the value field and the dropdown)

  3. Log in to comment