Hi all,
my question is easier to understand than it is to explain.
I basically have two classes
public class myfirstclass : MonoBehaviour {
public SortedList<int, transform> mylist;
}
public class mysecondclass : myfirstclass {
Transform mytransform;
}
Now, I have a custom editor for myfirstclass:
[CustomEditor (typeof(myfirstclass))]
public class myfirstclass: Editor {
private myfirstclass element;
void Awake () {
element = (myfirstclass)target;
}
public override void OnInspectorGUI() {
EditorGUILayout.LabelField("wdf");
DrawDefaultInspector();
}
}
This basically works whenever I drag myfirstclass in any gameobject, but If I assign mysecondclass to a gameobject, the custom editor part is not drawn for it, and it’ll just be presented as it would without editor.
I am here hoping that we can in some way call a parent class editor class, like for example we do with the “base” keyword in the Awake function.
It’d sound very stupid and ridiculous if we had to completely rewrite an editor class completely disregarding inheritance.
I cannot understate how much better this answer is. Its brevity belies its high accuracy.
– Thygrrr[CustomEditor(typeof(myfirstclass), true, isFallback = true)]There's also a third parameter to the constructor for the attribute in Unity, which determines whether the inspector should only be used as a fallback. Then you can Inherit from the UnityEditor.Editor ("Custom Inspector") if you want to do the base drawing, and still draw your custom stuff on top or below.