Search Issue Tracker

Active

Under Consideration for 6000.0.X, 6000.1.X, 6000.2.X

Votes

0

Found in

6000.0.45f1

6000.1.0b13

6000.2.0a8

Issue ID

UUM-102071

Regression

Yes

"ArgumentException" errors thrown when adding Buttons with sprites to a VisualElement that has a Label

-

How to reproduce:
1. Open attached “IN-98252” project
2. Open the “SampleScene” from the Scenes folder in the Project tab
3. Enter Play mode
4. Exit Play mode
5. Enter Play mode
6. Observe the Console and the Game view

Expected results: No errors thrown in the Console, buttons appear in the Game view with game pad button sprites and correlating name
Actual result: Multiple “ArgumentException” errors are thrown, buttons sometimes lack text or sprite or both

Reproducible with: 2023.2.0b4, 6000.0.45f1, 6000.1.0b13, 6000.2.0a8
Not reproducible with: 2022.3.60f1, 2023.2.0b3

Reproducible on: Windows 11
Not reproducible on: No other environments tested

Notes:
- Errors in the Console:
> ArgumentException: An item with the same key has already been added
> ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds
- Commenting out line 15 [container.Add(new Label("This label magically breaks everything."));] in the “Test” Script, that is attached to UIDocument, fixes the issue
- “NullReferenceException” errors are additionally thrown in 6000.2.0a8 Editor version
- Changing font in “USS” Style Sheet to “FontOK” fixes the issue (does not fix in 2023.2.0b4)

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.