Not signed in
Copyright © 2026 Unity Technologies
Steps to reproduce:
var newDropdown = new DropdownField { choices = new List<string>() { "\t", "1", "2" } };
2. view the window and select the second item from the dropdown (1)
3. select the first item (renders as an empty string)
Actual results:
throws the following error
IndexOutOfRangeException: Index was outside the bounds of the array. UnityEngine.UIElements.UIElementsUtility.ParseMenuName (System.String menuName) (at <7380b1ba6a1943f8acdb977b1081158a>:0) UnityEngine.UIElements.PopupField`1[T].GetValueToDisplay () (at <7380b1ba6a1943f8acdb977b1081158a>:0) UnityEngine.UIElements.BasePopupField`2[TValueType,TValueChoice].SetValueWithoutNotify (TValueType newValue) (at <7380b1ba6a1943f8acdb977b1081158a>:0) UnityEngine.UIElements.PopupField`1[T].SetValueWithoutNotify (T newValue) (at <7380b1ba6a1943f8acdb977b1081158a>:0) UnityEngine.UIElements.BaseField`1[TValueType].set_value (TValueType value) (at <7380b1ba6a1943f8acdb977b1081158a>:0) UnityEngine.UIElements.PopupField`1[T].set_value (T value) (at <7380b1ba6a1943f8acdb977b1081158a>:0) UnityEngine.UIElements.PopupField`1[T].ChangeValueFromMenu (T menuItem) (at <7380b1ba6a1943f8acdb977b1081158a>:0) UnityEngine.UIElements.PopupField`1+<>c__DisplayClass27_0[T].<AddMenuItems>b__0 () (at <7380b1ba6a1943f8acdb977b1081158a>:0) UnityEditor.GenericMenu.CatchMenu (System.Object userData, System.String[] options, System.Int32 selected) (at <c70b76c1ec924538944ac52fdfba807d>:0)
Expected results:
no error thrown, item is selected correctly.
From the discussion on slack, it sounds like allowing empty strings of any variety in the list is not allowed. I would expect in that case for this to throw an error much earlier, when setting the choices property. I'd also expect this behavior to be documented somewhere, I'm not seeing it here https://docs.unity3d.com/Manual/UIE-uxml-element-DropdownField.html
That said, I don't exactly understand why this design opinion is coming into the api - if a user wants to make a dropdown that is full of empty string, I'm not clear why we would make that impossible at the api level. It makes sense to include it in the design documentation.
Reproducible with versions: 2023.3.0b5 (dots monorepo currently)
Not reproducible with versions: I'm not sure of the specific version, but this is a regression - I believe the dots monorepo version from november doesn't have this issue.
Can’t test with versions:
Tested on (OS):
Notes:
Sign in to see your voted issues