TylerTemp / SaintsField

A Unity Inspector extension tool focusing on script fields inspector enhancement
MIT License
148 stars 9 forks source link

EnumFlags incorrectly treats `HasFlag` as toggled on mixed bits #20

Closed JoyousSuccess closed 4 months ago

JoyousSuccess commented 4 months ago

uh the EnumFlags thing doesnt work correctly as it should? (or am i wrong lol? ... think i had this code totally working in Odin.. odin annoying tho lol)

i have this enum

[Flags]
public enum Bldg_DestructState {
    NONE = 0,
    TOP_LEFT = 1, TOP_RIGHT = 2,
    BOT_LEFT = 4, BOT_RIGHT = 8,
    ADJ_LEFT = 16, ADJ_RIGHT = 32,
    FOUR = TOP_LEFT | TOP_RIGHT | BOT_LEFT | BOT_RIGHT
}

and your attribute thingy it will make the FOUR be an OR ... but its and AND... right.. ? also your on off replacing 0 ?

see this : https://giannisakritidis.com/blog/Enum-Flags-In-Unity/ info

... when i select TOP_RIGHT .. it also selects FOUR...

info2

JoyousSuccess commented 4 months ago

yeah in normal unity drawer i pick TOP_RIGHT it only does TOP_RIGHT ... if i pick FOUR it picks my four i set up info3 info4

TylerTemp commented 4 months ago

Confirmed. Yes, it's not correct. Thanks for reporting. Working on it.

TylerTemp commented 4 months ago

Please check if it's fixed in 3.0.1

https://github.com/TylerTemp/SaintsField/assets/6391063/6f5e3e57-85fb-44f2-ad5b-e269146b276c

JoyousSuccess commented 4 months ago

sry for delay.. seems to be fine now Thank You!

TylerTemp commented 4 months ago

Closed as fixed