I’ve been trying to figure out how to make custom inspectors clickable to launch Visual Studio or Monodevelop and still have not figured it out. Normally, on most MonoBehaviour inspectors there is a small greyed-out variable that says “Script” which you can click on to do this. For some reason on custom inspectors that variable disappears and I’d like to get it back.
You can use AssetDatabase.OpenAsset. But first you need to get the MonoScript asset from your MonoBehaviour instance.
MonoScript scriptAsset = MonoScript.FromMonoBehaviour(this);
AssetDatabase.OpenAsset(scriptAsset);
I ended up creating this static method that I call in OnInspectorGUI:
public static void ShowScriptFieldInCustomInspector(this SerializedObject serializedObject)
{
EditorGUI.BeginDisabledGroup(true);
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Script"));
EditorGUI.EndDisabledGroup();
}