Custom inspector for MonoScript

Hi!

I want to extend Inspector for MonoScript (any script in Assets folder) and display some information below standart script conter preview.

The problem is I can’t find any MonoScriptEditor to inherit from and inheriting from Editor removes MonoScript GUI (script preview, script name, Assembly information and so on).

using UnityEditor;

[CustomEditor(typeof(MonoScript))]
public class CustomMonoScriptInspector : /* ----> */ Editor // <---- What to put here?
{
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        
        EditorGUILayout.PrefixLabel("My additional info");
    }
}

This is not possible. I’m not sure why would you do this, but maybe you should try ScriptableObjects.

I’m a few years late, but this is possible by passing the MonoImporter type into the CustomEditor attribute, instead of MonoScript:

[CustomEditor(typeof(MonoImporter))]
public class ScriptInspector : Editor
{
    public override void OnInspectorGUI()
    {
        EditorGUILayout.LabelField("My additional info");
    }        
}

You can find the source code for the default MonoScript inspector here - it is an internal class so you can’t override from it, but it’s a good example to work off of.