Author Topic: Error when the Editor/Inspector is inspecting an image file  (Read 659 times)

This seems to have been introduced in earlier versions of 2021.1.x and was fixed but when you have the Substance plugin installed, you still get the error.

Based on the other threads, I'm going to guess that we need to wait for the new version of Substance. 

See the original defect: https://issuetracker.unity3d.com/issues/2d-propeties-of-an-image-cant-be-changed-if-changes-are-applied-through-popups

Verified the issue on:
Unity Editor - 2021.1.6 and 2021.1.7
Substance in Unity Plugin - 2.4.5 and 2.5.4
MacOS (based on the original defect, it seemed to be a defect that affected Macs only)

Steps to reproduce:
  • Install Unity 2021.1.7
  • Install Substance Plugin 2.4.5
  • Import any image
  • Select the image in the editor
See the following error:
Quote
InvalidCastException: Specified cast is not valid.
  at UnityEditor.TextureImporterInspector.get_textureInspector () [0x00000] in /Users/bokken/buildslave/unity/build/Editor/Mono/ImportSettings/TextureImporterInspector.cs:119
  at UnityEditor.TextureImporterInspector.DrawPreview (UnityEngine.Rect previewArea) [0x00009] in /Users/bokken/buildslave/unity/build/Editor/Mono/ImportSettings/TextureImporterInspector.cs:1597
  at UnityEditor.PropertyEditor.DrawPreviewAndLabels () [0x0050f] in /Users/bokken/buildslave/unity/build/Editor/Mono/Inspector/PropertyEditor.cs:1310
  at UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) [0x001df] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.u
i/Core/IMGUIContainer.cs:346
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEngine.UIElements.IMGUIContainer:DoOnGUI(Event, Matrix4x4, Rect, Boolean, Rect, Action, Boolean) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/IMGUIContainer.cs:360)
UnityEngine.UIElements.IMGUIContainer:DoMeasure(Single, MeasureMode, Single, MeasureMode) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/IMGUIContainer.cs:815)
UnityEngine.UIElements.VisualElement:Measure(YogaNode, Single, YogaMeasureMode, Single, YogaMeasureMode) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/VisualElement.cs:1539)
UnityEngine.UIElements.VisualElement:<AssignMeasureFunction>b__203_0(YogaNode, Single, YogaMeasureMode, Single, YogaMeasureMode) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/VisualElement.cs:1523)
UnityEngine.Yoga.YogaNode:MeasureInternal(YogaNode, Single, YogaMeasureMode, Single, YogaMeasureMode) (at /Users/bokken/buildslave/unity/build/External/Yoga/csharp/Facebook.Yoga/YogaNode.cs:689)
UnityEngine.Yoga.Native:YGNodeMeasureInvoke(YogaNode, Single, YogaMeasureMode, Single, YogaMeasureMode, IntPtr) (at /Users/bokken/buildslave/unity/build/External/Yoga/csharp/Facebook.Yoga/YogaNative.bindings.cs:146)
UnityEngine.Yoga.Native:YGNodeCalculateLayout(IntPtr, Single, Single, YogaDirection)
UnityEngine.Yoga.YogaNode:CalculateLayout(Single, Single) (at /Users/bokken/buildslave/unity/build/External/Yoga/csharp/Facebook.Yoga/YogaNode.cs:665)
UnityEngine.UIElements.UIRLayoutUpdater:Update() (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/Renderer/UIRLayoutUpdater.cs:51)
UnityEngine.UIElements.VisualTreeUpdater:UpdateVisualTreePhase(VisualTreeUpdatePhase) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/VisualTreeUpdater.cs:155)
UnityEngine.UIElements.Panel:UpdateForRepaint() (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/Panel.cs:940)
UnityEngine.UIElements.Panel:Repaint(Event) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/Panel.cs:985)
UnityEngine.UIElements.UIElementsUtility:DoDispatch(BaseVisualElementPanel) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/UIElementsUtility.cs:446)
UnityEngine.UIElements.UIElementsUtility:UnityEngine.UIElements.IUIElementsUtility.ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/UIElementsUtility.cs:209)
UnityEngine.UIElements.UIEventRegistration:ProcessEvent(Int32, IntPtr) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/UIElementsUtility.cs:74)
UnityEngine.UIElements.<>c:<.cctor>b__1_2(Int32, IntPtr) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/UIElementsUtility.cs:28)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

(Filename: /Users/bokken/buildslave/unity/build/Editor/Mono/ImportSettings/TextureImporterInspector.cs Line: 119)


Last Edit: May 16, 2021, 04:47:20 am

This seems to have been introduced in earlier versions of 2021.1.x and was fixed but when you have the Substance plugin installed, you still get the error.

Based on the other threads, I'm going to guess that we need to wait for the new version of Substance. 

See the original defect: https://issuetracker.unity3d.com/issues/2d-propeties-of-an-image-cant-be-changed-if-changes-are-applied-through-popups

Verified the issue on:
Unity Editor - 2021.1.6 and 2021.1.7
Substance in Unity Plugin - 2.4.5 and 2.5.4
MacOS (based on the original defect, it seemed to be a defect that affected Macs only)

Steps to reproduce:
  • Install Unity 2021.1.7
  • Install Substance Plugin 2.4.5
  • Import any image
  • Select the image in the editor
See the following error:
Quote
InvalidCastException: Specified cast is not valid.
  at UnityEditor.TextureImporterInspector.get_textureInspector () [0x00000] in /Users/bokken/buildslave/unity/build/Editor/Mono/ImportSettings/TextureImporterInspector.cs:119
  at UnityEditor.TextureImporterInspector.DrawPreview (UnityEngine.Rect previewArea) [0x00009] in /Users/bokken/buildslave/unity/build/Editor/Mono/ImportSettings/TextureImporterInspector.cs:1597
  at UnityEditor.PropertyEditor.DrawPreviewAndLabels () [0x0050f] in /Users/bokken/buildslave/unity/build/Editor/Mono/Inspector/PropertyEditor.cs:1310
  at UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) [0x001df] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.u
i/Core/IMGUIContainer.cs:346
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEngine.UIElements.IMGUIContainer:DoOnGUI(Event, Matrix4x4, Rect, Boolean, Rect, Action, Boolean) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/IMGUIContainer.cs:360)
UnityEngine.UIElements.IMGUIContainer:DoMeasure(Single, MeasureMode, Single, MeasureMode) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/IMGUIContainer.cs:815)
UnityEngine.UIElements.VisualElement:Measure(YogaNode, Single, YogaMeasureMode, Single, YogaMeasureMode) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/VisualElement.cs:1539)
UnityEngine.UIElements.VisualElement:<AssignMeasureFunction>b__203_0(YogaNode, Single, YogaMeasureMode, Single, YogaMeasureMode) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/VisualElement.cs:1523)
UnityEngine.Yoga.YogaNode:MeasureInternal(YogaNode, Single, YogaMeasureMode, Single, YogaMeasureMode) (at /Users/bokken/buildslave/unity/build/External/Yoga/csharp/Facebook.Yoga/YogaNode.cs:689)
UnityEngine.Yoga.Native:YGNodeMeasureInvoke(YogaNode, Single, YogaMeasureMode, Single, YogaMeasureMode, IntPtr) (at /Users/bokken/buildslave/unity/build/External/Yoga/csharp/Facebook.Yoga/YogaNative.bindings.cs:146)
UnityEngine.Yoga.Native:YGNodeCalculateLayout(IntPtr, Single, Single, YogaDirection)
UnityEngine.Yoga.YogaNode:CalculateLayout(Single, Single) (at /Users/bokken/buildslave/unity/build/External/Yoga/csharp/Facebook.Yoga/YogaNode.cs:665)
UnityEngine.UIElements.UIRLayoutUpdater:Update() (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/Renderer/UIRLayoutUpdater.cs:51)
UnityEngine.UIElements.VisualTreeUpdater:UpdateVisualTreePhase(VisualTreeUpdatePhase) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/VisualTreeUpdater.cs:155)
UnityEngine.UIElements.Panel:UpdateForRepaint() (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/Panel.cs:940)
UnityEngine.UIElements.Panel:Repaint(Event) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/Panel.cs:985)
UnityEngine.UIElements.UIElementsUtility:DoDispatch(BaseVisualElementPanel) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/UIElementsUtility.cs:446)
UnityEngine.UIElements.UIElementsUtility:UnityEngine.UIElements.IUIElementsUtility.ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/UIElementsUtility.cs:209)
UnityEngine.UIElements.UIEventRegistration:ProcessEvent(Int32, IntPtr) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/UIElementsUtility.cs:74)
UnityEngine.UIElements.<>c:<.cctor>b__1_2(Int32, IntPtr) (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/UIElementsUtility.cs:28)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

(Filename: /Users/bokken/buildslave/unity/build/Editor/Mono/ImportSettings/TextureImporterInspector.cs Line: 119)

Hey @wheee09 ,

Unfortunately the current version of the Substance in Unity plugin (2.5.4) does not support Unity 2021.1.6/7. The regression of this issue may be related to that. Apologies for the inconvenience. :( We are working to release the new version of the Substance in Unity plugin ASAP.