Jessy
September 23, 2009, 11:41am
1
I can’t do
GameObject tempPrefab = EditorUtility.InstantiatePrefab(//a prefab) as GameObject;
and then later
foreach (Transform child in tempPrefab.transform)
child.parent = //a transform;
because the parenting gets cut off at 16 game objects (and ones whose names end in odd numbers don’t move).
Does anyone have a good solution?
(dreamora’s next comment was made when this last line of pseudocode said //a game object instead.)
parent expects a transform, not a game object as it is an aspect of the transform hierarchy.
in the loop you have it right for the left side but the right side is wrong.
the compiler actually should tell you that too.
Jessy
September 23, 2009, 2:11pm
3
Sorry, I wrote that when I just woke up. What I said is happening, can’t happen, if I didn’t actually use a transform.
Jessy
September 23, 2009, 4:00pm
4
// The recursion is currently necessary.
// I will have reported the relevant bug later today, September 23, 2009
bool reparenting = true;
while (reparenting)
{
if (transform.childCount > 0)
foreach (Transform child in transform)
child.parent = anotherTransform;
else
reparenting = false;
}