Is DropdownField only usuable in editor?

Hi,

I’m trying out the UI Toolkit in the latest Unity 2022.1.0b8 and added a Dropdown field for runtime UI. I’m able to set the choices and the value in code however when clicking on the dropdown field it doesn’t open a dropdown to change the selection.

basically did something like this:

Add a DropdownField and name it “TestDropdown”.

In code do this:

List<string> choices = new List<string> {"test1", "test2", "test3"};
DropdownField dropdown= Root.Query<DropdownField>("TestDropdown");
dropdown.choices.AddRange(choices);
dropdown.value = choices[0];

Am I missing something to make the dropdown actually show in runtime?

Thanks!

1 Like

looks to be the same as the bug reported here:

The dropdownfield is not opening when using the mouse click. I need to select it with the mouse then hit space/enter on the keybaord to open.

1 Like

A fix for this seems to have landed in 2022.2.0a6, the process should bring it to 2022.1 soon.

1 Like