Hi, I searched on the forums about this simple question but I cannot find an answer to it, the question is simple, how do you remove all the children parenting to an object (in this case a transform node)?
do I need to remove it one by one? or is there an easy way to do it?
I’m pretty sure we have to remove each child’s parent relationship manually, but it can be done pretty simply in one line like below.
// remove children
ground.getChildren().forEach(child => child.parent = null);
// maintain absolute positions
ground.getChildren().forEach(child => child.setParent(null));
yeah, I actually was like “why not” and did a for loop, well if there is no other way I’ll stick with my loop