Add Dropdown Menues and Checkboxes to custom Editor windows

Hi folks,

I got a little problem with the editor modding, because the Unity GUI appears to have no sort of drop down menues or checkboxes implemented by default.

Let me first descripe to you what I’m about to do:

I got an array AR of a specific size in a static script A.
I got an Editor Modification Script B.

In this Editorscript B I would like to choose between ONE entry of the array AR.
Since only one could be active at a time a drop down menue or checkbox would make perfect sence.

I looked for some dropdown menue scripts but that mostly led to problems like
“no buttons underneath the dropdown entries” or “the number of entries has to be fixed” etc.
Ofc the size of the array AR is allways known, but someone who has mo idea of coding should be able to add simply entries to that array AR.

(its initialized in a way like that:
... {new myClass("stuff", 1), ("morestuff", 2), ... }
)

Someone who has no idea of coding could still edit the this list.

From this Array I would like to generate the entries in the dropdown menue.
So its kinda dynamically.

I tried to work arround this by implementing a own approch of a combobox, but this seems to be a kinda unperformant way:

pseudo code:

for( number of entries in AR )
   if( Toggle(...) )
      for(number of entries)
         uncheck Toggle
      check clicked Toggle

This obviously ends with a lot of GUI-Calls, and while this isn’t that much of a bad thing since my PC can handle this I’m pretty sure there is a better way to do so.

Has anyone of you encountered similar problems or know a better way to solve this problem?

Thanks for any help.

I realize this is years late, but hope it may help others down the road.
You can add a dropdown menu to the Unity Inspector quite easily by doing the following.

One script, placed on the gameObject will contain the dropdown menu contents (Bool appears at top of Inspector, no matter where you place it in code) You can add a lot more to this script to really flesh out your Inspector.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CustomUnit : MonoBehaviour
{
    
    public bool unitCrippled = false;

    [HideInInspector]
    public int racearrayIdx = 0;
    [HideInInspector]
    public string[] RaceArray = new string[] { "Human", "Elf", "Orc", "Goblin" };

    [HideInInspector]
    public int classarrayIdx = 0;
    [HideInInspector]
    public string[] ClassArray = new string[] { "Warrior", "Archer", "Mage", "etc" };
}

The second script will add the menus to the editor itself: (This is not attached to anything) (Idx is Index. ie. slot 1, slot 2, slot 3, etc.)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(CustomUnit))]
public class UnitEditor : Editor
{
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        CustomUnit script = (CustomUnit)target;

        GUIContent raceArrayLabel = new GUIContent("Race");
        script.racearrayIdx = EditorGUILayout.Popup(raceArrayLabel, script.racearrayIdx, script.RaceArray);

        GUIContent classArrayLabel = new GUIContent("Class");
        script.classarrayIdx = EditorGUILayout.Popup(classArrayLabel, script.classarrayIdx, script.ClassArray);
}