Is it possible to extend the custom editor for TextureImporter?
When I try:
[CustomEditor(typeof(TextureImporter))]
class ExtendedTextureImporterEditor : Editor
{
public override void OnInspectorGUI()
{
DrawDefaultInspector();
// My stuff here
}
}
The DrawDefaultInspector, unsurprisingly, just gives the generic data editor. I am guessing that I will need:
[CustomEditor(typeof(TextureImporter))]
class ExtendedTextureImporterEditor : TheExistingTextureImporterEditor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
// My stuff here
}
}
But I don’t know what to put for TheExistingTextureImporterEditor.
Unfortunately you can’t derive your custom inspector from TextureImporterInspector since it’s an internal class.
[CustomEditor(typeof(TextureImporter))]
internal class TextureImporterInspector : AssetImporterInspector
{
[...]
AssetImporterInspector is an internal abstract class. If you want to recreate the whole inspector you can Use ILSpy to see how the original is implemented, but you might have some limitations because they used some other internal stuff that is not available outside of the UnityEditor namespace.
The TextureImporterInspector is a quite complex class. I’m not sure if you really want to dig through it. I guess creating your own EditorWindow in combination with an AssetPostProcessor should be much simpler