I am trying to clone all nodes (including their material) recursively. I want to change certain material properties in the cloned nodes without impacting the original node(materials).
This is what I have so far, but it does not seem to be working. Any change made on the new nodes is still reflected on the original nodes.
SCNNode *newRoot = [self.root clone];
[newRoot enumerateHierarchyUsingBlock:^(SCNNode * _Nonnull node, BOOL * _Nonnull stop) {
SCNNode *oldNode = [self.root childNodeWithName:node.name recursively:YES];
node.geometry = [oldNode.geometry copy];
node.geometry.materials = [oldNode.geometry.materials copy];
}];
