How to extend component title bar?

Hello folks,

Is there any way to overwrite or extend Unity’s default component title bar?

21101-component_title_bar.png

I want to set a custom icon for my component, add a menu item to the component settings context menu (the gear button) and adding a link for my own documentation to the manual button. To make things further complicated: All my scripts are built in an external assembly.

I’ve seen a few assets with exactly this features, so there must be a way, but either I’m too stupid to find the right methods or it’s very ugly reflection magic.

See here for changing the icon.

The context menu item can be added like this.

This Answer offers a suggestion on how to make our own help button.

Custom icons, as far as I can find, can only be changed manually by going to the inspector for the component script and clicking the icon in the top left, then picking one from the list.

Adding items to the inspector context menus is done using the MenuItem attribute like so:

[MenuItem("CONTEXT/MyClass/Action")]
public static void DoStuff() {

}

Which adds an Action item to the context menu for any MyClass components.

Adding a help link unfortunately doesn’t seem to be possible. See How can I link to my docs in a Custom Inspector panel? and Custom help for editor scripts?. The help link only checks for Unity docs, and there’s no way to override it.