pretty simple I know, but I couldnt find out how to do it like this? Any help? Thanks.
Comes down to how much effort you want to put into it… Easiest is to just declare an enum
:
public enum Foo
{
Bar,
Bat,
Yabo,
}
And a public
variable of that type.
public Foo foo;
All that said, be careful with enums in Unity. It’s often better to use a ScriptableObject, even an empty one.
Enums enums can be problematic in Unity3D if you intend them to be serialized:
It is much better to use ScriptableObjects for many enumerative uses. You can even define additional associated data with each one of them, and drag them into other parts of your game (scenes, prefabs, other ScriptableObjects) however you like. References remain rock solid even if you rename them, reorder them, reorganize them, etc. They are always connected via the meta file GUID.
Collections / groups of ScriptableObjects can also be loaded en-masse with calls such as Resources.LoadAll<T>();
Best of all, Unity already gives you a built-in filterable picker when you click on the little target dot to the right side of a field of any given type… bonus!
I meant the (Additonal Settings) Header, not the other things
Oh gotcha, I think you want this:
It has some example code too.
Thank you, My bad, i should have been more clear.
Not a problem!!!
Sometimes it feels like 99% of the challenge is actually even finding the correct term to use.
Foldout? Header? Dropdown? Inset? Indent? Subheader??!!
Tell me about it, but basically im trying to store just serialized variables in there im not sure how, itsays it only works for methods?
I think Unity doesn’t have an out-of-box decorator but here’s an open source one that lets you just put [Foldout("Yabba dabba doo!")]
in your scripts: