Hi readers,
I am using NGUItools.AddChild(Parent, Prefab).
But when I was trying to add prefabs into the parent with array conditions, the arrangement seems to go wrong(the last object was added into the parent first instead of the first object).
Here the example code of how I do it:
public GameObject parent;
public GameObject prefab;
for(int i = 0; i<TotalNumberOfObjects; i++)
{
NGUItools.AddChild(parent,prefab);
prefab.name = "Object" + i;
}
The list of the prefabs added into the parent are as listed such as below:
1.)Object5;
2.)Object1;
3.)Object2;
4.)Object3;
5.)Object4;
Can you help me resolve this? Am I doing something wrong instead?
Thanks.