> For the complete documentation index, see [llms.txt](https://pahutyakv.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pahutyakv.gitbook.io/docs/savely.md).

# Savely

Savely exposes ready-to-use instances of all save handlers:

* `Savely.JSON`
* `Savely.JSONEncrypted`
* `Savely.Binary`
* `Savely.BinaryEncrypted`
* `Savely.Prefs`

It also manages the global root directory used by all modules and provides utility helpers for file operations.

***

### <mark style="color:$success;">**Set Root Directory**</mark>

The root directory should be set once when starting the game before interacting with Savely modules. By default, it uses: `Application.persistentDataPath`

```csharp
Savely.SetRoot("C:/MyGameData");
Savely.ResetRootToDefault();
```

***

### <mark style="color:$success;">**File Utilities**</mark>

Check if file exists:

```csharp
bool exists = Savely.ExistsFile("save", "json");
```

Builds a full file path inside the current root:

```csharp
string path = Savely.GetFilePath("save", "json");
```

***

### <mark style="color:$warning;">**Important**</mark>

`Savely.Binary` and `Savely.BinaryEncrypted` use .NET’s `BinaryFormatter`. Microsoft does **not recommend** using it for untrusted data due to security risks. However, for game save files where you control the data, it is generally safe. Serialized data may break if class definitions change or non-serializable Unity types are used.
