title: Unity3D. Instantiating and displaying enum objects using custom inspector
body: <p>My script extracts all child objects from a parent object. I need to assign materials individually to child objects or material to all objects via parent object.</p>
  
  <p>Currently when I change a child material, all other child object materials get changed aswell.</p>
  
  <p><a href="https://i.stack.imgur.com/nXioz.png" rel="nofollow noreferrer">How it looks in Unity when I change a child material</a></p>
  
  <p>Here is my code</p>
  
  <pre><code>if (includeChildObj == true)
      {
          EditorGUILayout.Foldout(includeChildObj, "List of Child Objects", includeChildObj);
          for (int i = 0; i &lt; Geometry.getChildNames().Count; i++) // loop through all child objects
          {
              GUILayout.BeginHorizontal();
              GUILayout.Label(Geometry.getChildNames()[i]); // display object name
         EditorGUILayout.PropertyField(serializedObject.FindProperty("SelectMaterial")); // find an enum which allows the dropdown list
              GUILayout.EndHorizontal();
              serializedObject.ApplyModifiedProperties();
          }              
      }
  </code></pre>
  
  <p>How is see it is that inside the FOR loop, for every Geometry object, I need to instantiate a new object of the corresponding enum. I am not sure how to do this as I am using CustomEditor not Monobehaviour.</p>
  
  <p>Thank you!</p>