Hi I am trying to remove all nodes from my Scenekit scene but I cannot for the life of me figure out a way.
It seems logical to me that there must be a function for doing this automatically but I cannot find it.
In context, I am trying to remove all nodes so I can reset my scene, which will happen reasonably often. Perhaps there is another way of doing this and I would be fine with that, I'm not stuck with having to remove all nodes.
Thanks!
Try this (assuming you are using Swift):
rootNode.enumerateChildNodes { (node, stop) in
node.removeFromParentNode()
}
Works for me.
For me worked like below:
sceneView.scene.rootNode.enumerateChildNodes { (node, stop) in
node.removeFromParentNode() }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With