Search Issue Tracker

Fixed in Built-in

Votes

2

Found in [Package]

Built-in

Issue ID

1413513

Regression

Yes

[UIToolkit] ArgumentExceptions are thrown and spammed after transition with empty property

Package: UI Toolkit

-

UIToolkit throws an ArgumentException followed by a continuous neverending stream of Exceptions when a VisualElement that is not the last element is removed from a Hierarchy and also when it has child elements that have transition USS directives that reference non-existent properties

Reproduction steps:
1. Open the user's attached project "UIToolkitIssue.zip"
2. Open the "Sample Scene"
3. Enter Play Mode
4. Click the Button at the top
5. Observe the Console window

Expected result: ArgumentExceptions are not thrown and spammed after transition with empty property
Actual result: ArgumentExceptions are thrown and spammed after transition with empty property

Reproduces on: 2022.1.0b14, 2022.2.0a9
Does not reproduce on: 2021.2.15f1
Could not test 2019.4.36f1, 2020.3.32f1 due to package errors when downgrading

Exception:
ArgumentException: An item with the same key has already been added. Key: UnityEngine.UIElements.StylePropertyAnimationSystem+ElementPropertyPair
at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x001cc] in <06a8633d56964cb4a0c4050a8ba5ed74>:0
at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <06a8633d56964cb4a0c4050a8ba5ed74>:0

Notes:
-Restarting the Editor/Player stops the Exceptions from being spammed in the Console
-This issue happens in both the editor and in players (tested on Android, iOS)
-This issue does not pop up if the element removed is the only/final element of the hierarchy of its parent
-This issue does not pop up if the property referenced in the transition actually is set. To see this, change minimalReproUSS.uss to:
.miau-button {
background-color: transparent;
transition: background-color 250ms;}

Comments (1)

  1. ainisciurlys

    Oct 26, 2022 10:40

    The fix was validated in 2023.1.0a2

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.