Is there a way to write a custom inspector routine for a type and have it be used automatically?

Ok, so say I have class foo. Its not a MonoBehaviour, but it has instances in a lot of monobehaviours. I have written a custom inspector routine for foo, but to use it I have to write an Editor and override the OnInspectorGUI routine for every MonoBehaviour that has an instance of foo, even though the only thing different from the default inspector I need is the inspector for foo.

Any solutions? Thanks.

Sounds like you should look at PropertyDrawers. With a property drawer, you can provide custom Editor logic for a given type, that then be reused across different types MonoBehaviours, without having to create a custom Editor from scratch for each MonoBehaviour. You can find an example here.