tbgox
February 20, 2022, 4:17am
1
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
tbgox
February 20, 2022, 8:35pm
2
looks to be the same as the bug reported here:
Only the spacebar works, I have submitted a bug report: CASE 1396778
Unity 2022.1.0b4.2571
I have also looked at the code from the repôsitory, it looks like there is no support at all for gamepad, and I cannot add it myself because the code uses a lot of internal and private members such as pseudoStates in VisualElement that is internal and ShowMenu in BasePopupField that is private... So if I wanted to implement myself opening the menu from gamepad I would not know where to start.
If Show…
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