GUI.ListBox

Here the script I found from the forums but the problem is cann’t under this language can any convert this to javascript :smiley:

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*.ToString (), GUI.skin.GetStyle ("Button")))*

There’s no need to convert it to UnityScript unless you want to change something in the function itself. In that case you should be able to do that conversion yourself.

To use the script from UnityScript you have to place this script in the Standard Assets or plugin folder. Now you can use the DropDownList function like it was written in UnityScript.

Also if you cross post add at least the link to the forums-thread:

http://forum.unity3d.com/threads/61924-listbox