foreach(Transform child in TheParent.transform) GameObject.Destroy(child.gameObject);
foreach(Transform child in TheParent.transform) print(“X”);
I tried DestroyImmediate and calling garbage collection but it doesn’t work I am still getting the X printed. Thanks.
DestroyImmediate should not be used during runtime, only in editor scripts. During runtime, objects are destroyed at the end of the frame.
If you explain what you are wanting to do and why we may be able to help resolve the issue.