Exports the scene and its contents to a file at the specified URL.
- iOS 10.0+
- macOS 10.9+
- Mac Catalyst 13.0+
- tvOS 10.0+
The URL to write the scene file to. This URL must use the
A dictionary of options affecting scene loading, or
nilfor default options. For available keys, see Scene Loading Options.
A delegate object to customize export of external resources used by the scene. Pass
nilfor default export of external resources.
A block that SceneKit calls repeatedly to report progress of the export operation.
true if exporting the scene was successful; otherwise,
The format of the output file depends on OS and argument file extension:
In iOS 10.0, tvOS 10.0, watchOS 3.0, OS X v10.11, and later versions, specify the
.scnextension to save a file in SceneKit’s native format. This format supports all features of SceneKit (including physics, constraints, and particle systems), and reading files in this format is faster than importing from other scene file formats.
In macOS only, specify the
.daeextension to export in Digital Asset Exchange (DAE) format for use by other apps. Exported DAE files do not contain scene elements specific to SceneKit, such as physics bodies and fields, constraints, and particle systems.
Older versions of iOS and tvOS don’t include the
write(to: method, but you can still produce a file in
.scn format through SceneKit’s support for the
NSSecure protocol. Use the
NSKeyed class to serialize a scene and all its contents, and the
NSKeyed class to load an archived scene.
If the scene references external resources, such as image files used in material properties, SceneKit exports these files to a nearby location and references their URLs in the exported scene file. To override SceneKit’s exporting of external resources, provide an object implementing the
SCNScene protocol in the