Search Issue Tracker

Fixed in 2021.2.X

Fixed in 2020.3.X, 2021.1.X

Votes

0

Found in

2021.1.0a9

Issue ID

1317450

Regression

Yes

Texture Importer Inspector throws errors when a built-in texture inspector is overwritten in C#

Texture

-

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:
```
[CustomEditor(typeof(Texture2D), false)]
class MixtureInspectorTexture2D : MixtureEditor
{
public override bool HasPreviewGUI() => true;
}
```

Repro steps:
- 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.

Comments (9)

  1. Bca0004d8955d116320cf45af90636dc?d=mm

    unity_8p6oRXXqiWbRTQ

    Jul 24, 2021 08:06

    THis is not fixed at all, getting this error in 2020.3.13f1

  2. 3ada2331c496d8b4b897657e07157ca4?d=mm

    nehvaleem

    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.

  3. 3216a956ef1bd4b75f29c6ee5bf747db?d=mm

    gonenb_unity

    Jul 19, 2021 10:11

    Not fixed, please reopen

  4. 64997828c7bb6a64e0f8a050a5963125?d=mm

    iamarugin

    Jul 17, 2021 08:51

    5 months have passed and still no fix for the UNITY LTS VERSION.

  5. Cf1e58f9ef36712ab70e017e7ac3f7e0?d=mm

    io-games

    Jul 13, 2021 06:37

    Sorry, for prev comment. It's because Substance.Editor.TextureInspector can not cast

  6. Cf1e58f9ef36712ab70e017e7ac3f7e0?d=mm

    io-games

    Jul 13, 2021 06:31

    Not usable editor for art team at all.
    2021.1.13f1

  7. 7e5b05115e0d7b6526fb9dd32d10237c?d=mm

    Hyperg

    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...

  8. Ec66a1ee29ad359519fb24654310c2eb?d=mm

    daneobyrd

    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.

  9. C7d5985cfab5e24ae705187d6a6cd1c1?d=mm

    futurlab_peterh

    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.

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.