listbox

How would i create a listbox, like the one in Visual Basic? Is it possible and if so would i be hard?
I mean it would display a lot of items, 1k+, and you’d be able to select any of them and something would happen then.
Maybe someone already made one?

Thanks

woudl require a 2 script based approach as the folded out list must be in an own ongui script to use GUI.depth

Implemented one recently and its not reasonably as easy to develop nor use as listboxes etc in UI targeted programming languages

wouldn’t it be possibel though to simply create a gui window, make it kinda small, add scrolls (vertical or horizontal, forgot which goes what direction lol) then for each gameobject add a text (gui label or what ever it is), make it change into some other color or something on hover and on click do some action. Wouldn’t that work?

Yep. That would work. Your only issue would be to properly communicate the list to use in the window to the window method. One way of doing that could be something like this (untested):

List<List<object>> s_DropDownLists = new List<List<object>> ();

// ...

static bool DropDownList (bool open, List<object> list, ref int selectionIndex)
{
    open = GUILayout.Toggle (open, List[selectionIndex].ToString (), GUI.skin.GetStyle ("TextField"));
    if (open)
    {
        Rect dropDownRect = GUILayoutUtility.GetLastRect ();
        dropDownRect = new Rect (dropDownRect.x, dropDownRect.y + dropDownRect.height, dropDownRect.width, dropDownRect.height * 3.0f);
        list.Add (selectionIndex);
        s_DropDownLists.Add (list);
        GUI.Window (s_DropDownLists.Count - 1, dropDownRect, OnDropDownListGUI, GUI.skin.GetStyle ("Box"));
        s_DropDownLists.RemoveAt (s_DropDownLists.Count - 1);
        list.RemoveAt (list.Count - 1);
    }
}

static void OnDropDownListGUI (int id)
{
    List<object> list = s_DropDownLists[id];
    for (int i = 0; i < list.Count - 1; i++)
    {
        if (GUILayout.Toggle (list[list.Count - 1] == i, list[i].ToString (), GUI.skin.GetStyle ("Button")))
        {
            list[list.Count - 1] = i;
        }
    }
}

Can any one do this in JS plz I need this in JS