I’ve got an object (‘DotsHolder’), which is the parent object to many gameobjects. I would like to destroy all these objects.
I’m calling destroy on each of the child.gameobjects, but after going through the list they all remain. I see no errors in the console.
Transform dotHolder = this.transform.FindChild("DotsHolder");
Debug.Log("Destroying: " + dotHolder.GetChildCount());
for(int i=dotHolder.GetChildCount()-1; i>=0;--i){
Destroy(dotHolder.GetChild(i).gameObject);
}
Debug.Log("Remaining: " + dotHolder.GetChildCount());
In the log at this point I see:
Destroying: 244
Remaining: 244
Why is the ‘remaining’ count not zero at this point?