Scripting a DropDown Menu in the Inspector

Right now, i want to look for a way to make a dropdown menu in the inspector. What I am looking for is a way to script a dropdown menu, similar to the input settings, where i can choose how many “items” i want, and then manipulate them all. So, i have a person who has 3 different things to say. Then another person has 5 different things to say. This creates a drop down for different text boxes, etc.

If i am confusing anyone, basiclly i am looking to make my own “input” selection where u can choose the amount of things i want. See the input settings to see what i mean.

Hmmm, ill bump this so i can hopefully get an answer…

You can use a EditorGUI.Popup but in the inspector you need to know where to place it as it wont automatically sit where you want it.

Code is untested, I don’t have unity where I am atm.

int mySelection;
string[] myList = {"Sword","Axe","Giant Leg"};

Rect r = EditorBUILayout.BeginVertical();

r.width = 100;
r.height = 25;

mySelection = EditorGUI.Popup(r, "Select one please: ", mySelection, EditorStyles.popup);

EditorBUILayout.EndVertical();

Hmmm, im not sure how that works. There are a couple of errors and i cant quite figure out what is wrong. Any other suggestions?

Create a public String builtin array -

var strings : String[ ];

That’ll get you something similar. You can also create your own classes and do the sme thing with them.

Thanks. That is exactly what i needed.