---
title: "write(to:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/entity/write(to:)"
---

# write(to:)

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

## Declaration

```swift
@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

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. important: During its initial setup phase, this method can indirectly block the main thread, and also has the potential to block it for the full duration of the call if the system has additional work it needs to do there.
