assign new enum states through inspector

Ok, im not sure if my logic, idea, theory, whatvever you would want to call it, is way out to lunch here or… but my idea, requires me to have a set of states. But the states need to be added upon. So i was wondering, if its possible to create a enum, somehow, that can have additional states added to it through the inspector? During runtime, it would never be added too, but during development, it would be beneficial for certain aspects.

Sorry if this seems rediculous, i honestly have no clue if this is possible or no, but if it is , it would be amazing.

I don’t think you can do it with an enum, but you could do it with a string :slight_smile:

Yes you can

needs[i].needName = (NeedNames)EditorGUILayout.EnumPopup("Need Name", needs[i].needName);

where NeedNames is an enum.

But you have to rewrite all the public variables, since you need to use an editor class for your class. There are quite a phew examples around, for example the one in locomotion class.

Aight , thanks guys , i will look into that scarpelius, ty.

if NeedNames is an enum, then whats needName ?

You just dredged up a thread that has been dead for 13 years.

In this example,

  • NeedNames is a type of variable, a variety of enum.

  • needs<em>.needName is an actual variable of the type NeedNames.

  • [/LIST]*

  • You infer this from knowledge of the C# language, and also the common naming convention, even if you don’t have all the source code.*

1 Like