Flag Enum dropdown disorder when using long instead of int

Issue #181 resolved
yc960 created an issue

Editor dropdown disorder with following, only when bit shift goes beyond 32

    [Flags]
    public enum PartRegistration:long
    {

        Ship = 1 << 0,
        Walker = 1 << 1,
        Vehicle = 1 << 2,
        Infantry = 1 << 3,
        Structure = 1 << 4,
        Small = 1 << 7,
        Medium = 1 << 8,
        Large = 1 << 9,
        ExLarge = 1 << 10,
        Mega = 1 << 11,
        Weapon = 1 << 13,
        Hull = 1 << 14,
        Lv1 = 1 << 18,
        Lv2 = 1 << 19,
        Lv3 = 1 << 20,
        TypeA = 1 << 33,
        TypeB = 1 << 34,
        TypeC = 1 << 35,
        TypeD = 1 << 36,
        TypeE = 1 << 37,
        TypeF = 1 << 38

    }

Comments (2)

  1. Tor Esa Vestergaard
    • changed status to open

    Hmm, I've managed to reproduce this. It's a little odd, but this seems to be the order that C# actually gives us the names and values in when we ask for them using Enum.GetNames and Enum.GetValues. I'll investigate what's going on, and whether we can reasonably do something to sort them properly.

  2. Antonio Rafael Antunes Miranda

    The improved enum dropdown, which can be activated/deactivated by navigating to Tools > Odin Inspector > Preferences > General > Enums, fixes this.

  3. Log in to comment