When I ran the code from list lecture, it crashed Unity.
I think the iterator for children has changed from 4.x to 5.x and it is now updated with the complete list of children on every iteration which causes an infinite loop. I solved this by modifying the code to be:
Transform[] children = GetComponentsInChildren<Transform>();
foreach (Transform child in children)
{
GameObject enemy = Instantiate(EnemyPrefab, child.transform.position, Quaternion.identity) as GameObject;
enemy.transform.parent = this.transform;
}
Can anyone confirm this is still correct and what changed between Unity 4.x and 5.x?