- Home /
CustomEditor for TextureImporter?
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
.
Answer by karl_ · Aug 01, 2011 at 11:26 PM
Check out Statement's answer to a similar question: http://answers.unity3d.com/questions/55722/custom-inspector-element-on-texture-importer.html
Thanks for confirmation. I think it's time we solved the "Custom Asset Importers" problem once and for all. I'll be back...
Answer by Bunny83 · Aug 01, 2011 at 11:53 PM
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 ;)
Well :D that's actually what Statement said already in the linked answer of $$anonymous$$arl.