Is there a construct in JavaScript or Unity which behaves like a typical flag structure and have an associated editor.
For example, in C++ I would have:
enum { FLAG1 = 1 << 0, FLAG2 = 1 << 1, FLAG2 = 1 << 2, FLAG3 = 1 << 3 };
u8 myFlags = FLAG1 | FLAG3;
myFlags |= FLAG2;
And I would imagine an editor would work like a list of booleans, or an enum dropdown with checks for which values are present.
Thanks for the help
An enum works just like that.
enum foo {bar, bash, bang};
var blah : foo;
In the inspector, the variable blah has a drop-down of values from the enum foo.
To allow for multiple simultaneous selections is a bit trickier. That requires something that will generate an IntPopUp. One of the things that gets in the way is that .Net doesn't implicitly treat ints as enum types (and vice versa) and another is that Unity's inspector doesn't seem to do anything special with the System.FlagsAttribute as near as I can tell.
I'm still digging to find a way to serialize something in generic other than a LayerMask which generates an IntPopUp. As it stands, the only way that I can see is to create a CustomEditor for scripts and a custom class of integer or enum for which your CustomEditor will generate an IntPopUp. Please see these scripts for an idea of how to get started on that.