- Home /
 
               Question by 
               Aram-Azhari · Nov 07, 2014 at 10:44 AM · 
                listcustomeditorpropertyfield  
              
 
              Call EditorGUILayout.PropertyField of an element of an array
Hi,
I have a class A that inherits from Monobehaviour, with public variables:
 public class A : MonoBehaviour
 {
   public int num;
   public string s;
 }
When you add A component to a gameobject, you can easily modify the variables, since it has its inspector drawn automatically.
But I have another class B
 public class B : MonoBehaviour
 {
 
 public List<A> vars;
 }
Now I want to create a custom editor for B:
 [CustomEditor(typeof(B))]
 public BEditor: Editor
 {
   public override void OnInspectorGUI()
     {
         var t = target as B;
             
         for (int i = 0; i < t.vars.Count; i++)
         {
             // Here I want to DrawDefaultInspector for t.vars[i] 
             // or in other words the default inspector for an object 
             // of class A
         }
         DrawDefaultInspector();
     }
 }
How do I draw the default inspector of an object inherited from class A, within custom editor of class B?
How can I do this with minimum pain? (Note: I can go reflection, I consider that to be no pain)
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
A node in a childnode? 1 Answer
Editor Reorderable List - Properties 1 Answer
[Custom editor] Having trouble getting list count inside a for loop 1 Answer
Editor: How to do PropertyField for List elements? 4 Answers
Nesting custom inspectors 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                