Search Issue Tracker
Fixed in 2021.2.X
Fixed in 2020.3.X, 2021.1.X
Texture Importer Inspector throws errors when a built-in texture inspector is overwritten in C#
When a custom inspector targetting Texture2D, Cubemap or Texture3D is present in the project, the texture importer inspector of these assets throws errors when they are displayed in the inspector window.
Stacktrace of the error:
InvalidCastException: Specified cast is not valid.
UnityEditor.TextureImporterInspector.get_textureInspector () (at <280242b5f32c446482b2e1fcdf7e6d80>:0)
UnityEditor.TextureImporterInspector.DrawPreview (UnityEngine.Rect previewArea) (at <280242b5f32c446482b2e1fcdf7e6d80>:0)
UnityEditor.PropertyEditor.DrawPreviewAndLabels () (at <280242b5f32c446482b2e1fcdf7e6d80>:0)
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) (at <b50b24924f4d442fb2face92883f4dc2>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
Here's an example of custom editor that causes the error:
class MixtureInspectorTexture2D : MixtureEditor
public override bool HasPreviewGUI() => true;
- Download the repro project
- Select the texture A in the Assets folder
- Observe errors in the console, like in the attached gif.
Note that the issue doesn't repro on 2020.2. Tested on Unity 2021.1 and 2021.2.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- [Android] Text input field doesn't disappear when pressing "Enter" on the keyboard connected to a device and HideMobileInput is disabled
- WebGL Player flickers and logs warnings when viewport is resized and "Linear" Color Space is used
- Rigidbody recalculates its center of mass when moving its child Trigger Collider
- Sprites with different indexes than indicated in Text field of Label Inspector are being rendered
- VFX rendering a sphere when using a custom mesh
Nov 24, 2021 04:46
There has been no patch for the UNITY LTS VERSION in 5 months. https://b2b.partcommunity.com/community/groups/topic/view/group_id/1747/topic_id/13747/post_id/35683
Jul 24, 2021 08:06
THis is not fixed at all, getting this error in 2020.3.13f1
Jul 22, 2021 08:50
Come on, guys. LTS having the lowest priority. Bug reported in February. Still. Not. Fixed.
Could you explain what the LTS means then? Because I am surely misinterpreting this.
Jul 19, 2021 10:11
Not fixed, please reopen
Jul 17, 2021 08:51
5 months have passed and still no fix for the UNITY LTS VERSION.
Jul 13, 2021 06:37
Sorry, for prev comment. It's because Substance.Editor.TextureInspector can not cast
Jul 13, 2021 06:31
Not usable editor for art team at all.
Jul 12, 2021 08:20
This issue is currently present in 2020.3.12f1 and 2020.3.13f1 and the art team cannot basically use the editor in its current state. Please bump up the importance of this issue before applying the "LTS" status to these builds...
Jun 23, 2021 17:13
I am continuing to get this error even in 2020.3.12. Not being able to view textures in the inspector is becoming a real annoyance and should be a priority.
Jun 07, 2021 15:16
This issue got introduced somewhere between 2020.3.5f1 and 2020.3.9f1.
On our project we're able to repro it on 2020.3.9f1, but not after downgrading back to 2020.3.4f1.