EditorGUILayout.ObjectField and array
Hey,
I've read every single question about adding array to ObjectField but I cannot find a solution I need.
So basically I need to able to select, for example, 20 GameObjects in the hierarchy and drag and drop them into my custom GUI editor window so I can loop through the array and perform an operation on each object.
I thought the code would be:
var GameObject[] m_OldObjects;
oldObjects[] = EditorGUILayout.ObjectField("My Label", oldObjects[], typeof(GameObject), true) as GameObject;
But this doesn't work :(
If this worked just how an array is treated using the ScriptableWizard then it would be perfect.
Any help in getting this to work would be much appreciated! Thanks
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612065638im_/https://answers.unity.com/themes/thub/images/avi.jpg)