Contents

write(to:)

Exports the entity as a RealityKit file to a location in the file system.

Declaration

@MainActor func write(to url: URL) async throws

Parameters

  • url:

    The location URL in the file system where you want to save the .reality file.

Discussion

This method generates a file with a .reality suffix, automatically setting its compatibility with other systems based on the Entity’s tree content. The Entity and its children may contain components or assets that can require the resulting RealityKit file to be compatible with system versions between:

  • iOS 18 or later

  • macOS 15 or later

  • visionOS 2 or later

Logs with the prefix [RealityKit File Compatibility Info] will be posted to the console whenever a component or asset requires a compatibility adjustment.