> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rollingquest.kramgames.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Persistent State

> How the RollingQuest editor preserves your workspace between sessions: camera, selector, and level data persistence.

The editor automatically saves your workspace state between sessions. When you close and reopen the editor, it restores your previous position and level data.

## What Is Persisted

| Data                    | Storage                                       | Default      |
| ----------------------- | --------------------------------------------- | ------------ |
| Camera Position         | `EditorPersistentState.CameraPosition`        | `(0, 2, -3)` |
| Camera Rotation         | `EditorPersistentState.CameraRotation`        | `(-20, 0)`   |
| Block Selector Position | `EditorPersistentState.BlockSelectorPosition` | `(0, 0, 0)`  |
| Level Data              | `EditorPersistentState.LevelData`             | `null`       |
| Level Path              | `EditorPersistentState.LevelPath`             | `null`       |
| Best Editor Time        | `EditorPersistentState.BestEditorElapsedTime` | `null`       |

## How Persistence Works

### On Editor Load

1. `LoadPersistentData(true)` is called during `Start()`
2. Camera position and rotation are restored
3. Block selector position is restored
4. If level data exists, the level is rebuilt from it
5. The best editor time is restored

### During Editing

State is not continuously saved — it is saved explicitly when:

* Testing the level (`TestCurrentLevel`)
* Quitting the editor (`OnMainMenuSelectChoice` with `Quit`)
* Reloading the editor

### On Editor Quit

1. Current level data is built from the editor state
2. Camera position, rotation, and selector position are saved
3. Level data and path are saved
4. The state persists until the next editor session

## Static Storage

`EditorPersistentState` is a static class — its data persists across scene loads within the same application session. However, data is lost when the application is closed.

<Note>
  The persistent state is not the same as saving a level file. Persistent state is session-only. To permanently save your work, use the Save menu.
</Note>

## Reload Behavior

When the editor reloads (e.g., after testing or switching sections):

1. `ClearLevel()` is called — removes all blocks, items, enemies
2. `LoadPersistentData(false)` restores the saved state
3. If no saved data exists, a new empty level is created
