Unity GUI Dropdown by furaga - 5


Implementation GUI.Dropdown for Unity C# script

Unity 2020.1.2f1MIT LicenseUpdated 274 days agoCreated on August 14th, 2020
Go to source


What is this

An implementation of dropdown for Unity script without GameObject.
There are GUI.Button(), GUI.Slider(), … however there is NOT GUI.Dropdown()

Therefore, we implemented GUIEx.Dropdown().

How to use

GUIEx.DropdownState state_ = new GUIEx.DropdownState();

void OnGUI()
    state_ = GUIEx.Dropdown(
        new Rect(30, 30, 100, 30),
        new[] { "A", "B", "C" },

    Debug.LogFormat("Selecting {0} ({1})", state_.Caption, state_.Select);

You can know which option is selected from state_.Select and state_.Caption.

Show all projects by furaga