- Home /
 
 
               Question by 
               Harter · Dec 05, 2013 at 09:13 AM · 
                editorinspectorchildinheritancecustomeditor  
              
 
              CustomEditor and inherited components
I have two classes (base and inherited) and one custom editor component for base class.
Base: 1)
 public class HF_Manager : MonoBehaviour
 {
     public virtual void OnUpdateData() { }
 }
 
               And inherited: 2)
 public class HF_ChairsManager : HF_Manager
 {
     public override void OnUpdateData() { /* special case */ }
 }
 
               And I have a CustomEditor script for base class (HF_Manager):
 [CustomEditor(typeof(HF_Manager))]
 public class HF_ManagerEditor : Editor
 {
     public override void OnInspectorGUI()
     {
         DrawDefaultInspector();
 
         if (GUILayout.Button("Update Data"))
         {
             HF_Manager t = (HF_Manager)target;
             if (t != null)
                 t.OnUpdateData();
         }
     }
 }
 
               My task is to make "Update Data" button for each inherited component, which should fire HF_Manager's OnUpdateData() method.
But now I see "Update Data" button only on HF_Manager component...

               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Harter · Dec 05, 2013 at 09:14 AM
RTFM.

Wow, i didn't notice this change... In the past you couldn't create one customeditor for a whole inheritance tree. Have to check the release notes if they mention this change somewhere ;)
Thanks for this.
edit
Found it ;) It has been introduced in Unity 4.1 (7th point under "Improvements")
Your answer