While working on a project of mine today, I ran into something that seemed odd. The code below is where I found this occurring
foreach (NodeAndNeighbors nd in nodeList) {
GameObject temp = Instantiate(navNodeGen, new Vector3(nd.x * radius, nd.y * radius, nd.z * radius), Quaternion.identity) as GameObject;
temp.transform.parent = GameObject.Find("NavMap").transform;
navNodes.Add(temp);
}
Now, the size of loop is around 60 thousand. The weird thing is… whenever the below ling is not commented out, this loop causes Unity to go unresponsive. It seems weird that reassigning the transform should be a fairly easy operating compared Instantiating that many game objects. Anyone know why this might be the case?
temp.transform.parent = GameObject.Find("NavMap").transform;