Compound custom inspectors for sub classes

I have a class called “GameItem” and a subclass called “WeaponItem”
Both of them have custom inspectors and allow me to edit anything specific to that class.
However, I’d like the subclass “WeaponItem” to also render the custom inspector elements from the superclass “GameItem” at the same time as the sub-item’s custom inspector when it’s selected… However I don’t know how to do this.

I can get this to work to show the default inspector for “GameItem” at the same time as the custom inspector for “WeaponItem”, but not custom for both.

You may ask yourself, “Why not just put all of the inspector code in the subclass”… To which I have to say there may be 100’s of subclasses and I don’t want to keep copying code.

I’d also note that I’ve seem similar, but not the same questions on here before.

Of course I find the answer right after I ask the question.

Here’s how I got it working and it’s quite obvious really:

  1. The subclasses custom editor class needs to derive from the base custom editor class not Unityeditor.Editor

  2. In the sub class’s OnInspectorGUI, you need to call the base classes UI render with base.OnInspectorGUI();