- Home /
Making enum visible in the Inspector via a drop down list
Hi I would like to know if there is a way to create a script that makes a drop down list of options to choose between in the inspector.
So for example: Weapon Type: None
and you click on the None and it shows you
None Bazooka Mini Gun Sword
whichever you select it changes the value to the variable accordingly.
Not that it prevents me from making my game but It would make it easier for when I get to level design to not have to remember all the types when I go to make my levels.
Thanks for all the help.
Update: So I figured out how to make a enum, but still don't know how to make it show in the inspector.
Answer by Lab013 · Mar 17, 2011 at 02:01 AM
enum MyEnum{
myEnum1,
myEnum2,
myEnum3
};
and then in your script file put
var varname : MyEnum; // has a drop down list in inspector.
Answer by BradLeeD · Feb 25 at 08:22 AM
Just make it public. That'll expose a dropdown in the inspector. The better question is how to make it public and NOT have a dropdown appear.