Open tyapichu opened 6 years ago
Hey, you are not the only one try to use array for `enum' type. :-)
1) Could you tell me more details what 'flag ability of enum' you want to see in the document?
2) I want to know why you need enum array. I wonder how and why some people try to use enum array and want to know its real user cases.
1) I was not sure what will I get as a result of importing array of enums. To be honest I didn't know about flags attribute before I stated diging in bug. So I was expecting an array, an when I didn't saw it it debug I desided that I did something wrong it config sheet. It is probably obvious to a professional and I understand that it s right to use flags enum, but it was not obvious for me.
2) I'm configuring list of actions i can apply to items in game inventory.
[Flags]
public enum ArticleAction
{
NoAction = 2,
TakeOn = 4,
Recycle = 8,
Open = 16,
}
So I can use Switch selection statement to choose what buttons to show and what actions to apply. For example I can Open a chest and can TakeOn or Recycle a weapon.
Several years ago I worked as game designer on project where programmers used bit flags to configure actions for items. It was easy enoth for me, so I liked this idea - one number to describe item actions. may be i could use one enum to describe differen cases like "TakeOnAndRicycle", "TakeOnAndOpen"... or I could use int field of sum of bit flags like i had to use on that project... and I would have done so if I had not dealt whith bug my way.
I agree. Supporting [Flags]
attribute of enum type sounds great.
I'll look it later.
Also I found some related pages with googling for references purpose:
I'm using QuickSheet to import data from google sheets. I've tryed to import array of enum alues. QuickSheet imports data correctly (it whould be much better if you mention about flags ability of enums in documentation... i was expecting an array of enums though flags enum is more correctly). But watching on data scriptable object in Inspector leads to massive oet of range error messages spam. They appear because enumValueIndex in
GUIHelper
class can't handle whith multivalue enum. If enum property is multivalue the enumValueIndex returns -1 which leads to error message.I've added some code to solve the problem my way, but i'm not experienced enouth to find professional solution of this problem.
Sorry if doublig...