Search Issue Tracker
Fixed in 1.0.0-preview.7
Votes
0
Found in [Package]
1.0.0-preview.3,Preview- 0.11.2, Preview 0.8.4, Preview 0.8.2
Issue ID
1265096
Regression
Yes
[UI Toolkit] InvalidOperationException on assigning any image to Image property in UI Tooltip Inspector
On assigning any image to Image property under the Background in UI Tooltip Inspector Editor throw InvalidOperationException error, refer the attached video.
Steps to repro:
1. Open attached project "UIToolkitTest.zip"
2. Project > test.uxml > Dubble Click
3. UI Builder > Hierarchy > Label > Inspector > Image > assiged any Image
Actual Result:
InvalidOperationException on assigning any image to Image property in UI Tooltip Inspector
Expected Result:
No error in the console
Reproducible in:
2020.2.0a18, 2020.1.0f1 with Package Version 1.0.0-preview.3.
2019.2.14f1 with Package Version Preview- 0.11.2, Preview 0.8.4, Preview 0.8.2
Working fine on:
2019.2.14f1,2019.2.0a1 with Package Version Preview 0.8.1
Environment:
Windows 10 & Mac 10.14.
Stack Trace
InvalidCastException: Specified cast is not valid.
Unity.UI.Builder.BuilderInspectorStyleFields.OnFieldObjectValueChange (UnityEngine.UIElements.IEventHandler target, UnityEngine.Object newValue, UnityEngine.Object previousValue, System.String styleName) (at library/packagecache/com.unity.ui.builder@1.0.0-preview.3/editor/builder/inspector/builderinspectorstylefields.cs:1667)
Unity.UI.Builder.BuilderInspectorStyleFields.OnFieldValueChangeImpl (UnityEngine.UIElements.IEventHandler target, UnityEngine.Object newValue, UnityEngine.Object previousValue, System.String styleName) (at library/packagecache/com.unity.ui.builder@1.0.0-preview.3/editor/builder/inspector/builderinspectorstylefields.cs:1645)
Unity.UI.Builder.BuilderInspectorStyleFields.OnFieldValueChange (UnityEngine.UIElements.ChangeEvent`1[T] e, System.String styleName) (at library/packagecache/com.unity.ui.builder@1.0.0-preview.3/editor/builder/inspector/builderinspectorstylefields.cs:1633)
Unity.UI.Builder.BuilderInspectorStyleFields+<>c__DisplayClass28_0.<BindStyleField>b__12 (UnityEngine.UIElements.ChangeEvent`1[T] e) (at library/packagecache/com.unity.ui.builder@1.0.0-preview.3/editor/builder/inspector/builderinspectorstylefields.cs:193)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- UI Toolkit 'background-size' property is not fully animatable
- Moving the Scrollbar via clicking no longer works after the first-click when page size is too small
- Elements in UI Builder Viewport are displayed incorrectly when Editor UI Scaling is set to 125%
- Prefab referencing a script is not shown in the Search window's Project tab when using "Find References In Project"
- Scroll view sensitivity remains unchanged when modifying the "--unity-metrics-single_line-height" value
Resolution Note (fix version 1.0.0-preview.7):
What was fixed was the null reference exception itself, not being able to assign built-in images to styles in the UI Builder. Please note that this bug was not for "any image", just images that come from Unity Editor's internal built-in resources. This is still not possible (and there has always been a clear message appear when the user tries to do this), but in 1.0.0-preview.7, we fixed the null references error in the Console which was not supposed to be fired in this case.