Forum rules - please read before posting.

Dropdown box in ShowGUI for custom action

I have a custom action and I need a way to make a dropdown box that will simply display a combobox/dropdown with some strings in it, is that possible? And if so any examples around? Maybe this is entirely unity and not at all AC, I havent learned much about this side of unity gui things.

Comments

  • edited May 2017
    Create an enum with all the options you want:

    public enum yourEnumType
    {
    optionA,
    optionB
    }

    public yourEnumType YourEnumVar;

    -Then in ShowGUI use: 

    YourEnumVar= (yourEnumType)EditorGUILayout.EnumPopup("my options:",YourEnumVar);

    -Them in your run() use:

     switch(YourEnumVar)
     {
     case optionA:
     //do something
     break;
     case optionB:
     //do something
     break;
     } 
     
     OR
     
     if(YourEnumVar==yourEnumType.optionA)
     {
     //do something
     }
     
    ...google for the proper caps and spelling, but that's the guist of it.
  • thanks very much, that is great, AC custom actions absolutely rock!!!.. 
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.