How to write all nodes to a .dae file using scnscene.write()?

Hi. Im currently programming an export function for my arkit app. The user should have the possibility to export the scene that he created. Unfortanatly always only one node gets exported. How can I export all nodes?

let scene2 = SCNScene()

let documentsPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!

let timeInterval = Date().timeIntervalSince1970 * 1000

let filename = String(format: "export_%d.dae", timeInterval)

let exportUrl = documentsPath.appendingPathComponent(filename)

scene2.write(to: exportUrl, options: nil, delegate: nil, progressHandler: nil);

Replies

Hello,


The write(to:options:delegate:progressHandler:) method should export all of the nodes in your scene. I am unable to reproduce the issue using your code.


Are you sure that your "scene2" actually has more than one node when you call write?


If you continue to see this behavior, please file a bug report at https://developer.apple.com/bug-reporting/.