The gap
Simple save code writes straight over the only copy of the player's progress, cannot tell a damaged file from a good one, and breaks old saves as soon as the data classes change.
Game dev tools
Players never lose progress to a crash or a damaged file: versioned slots, atomic writes, checksums, self-healing backups, JSON migrations, AES encryption, async API. Unity editor not run; core tested with .NET.
Coming soon
Not published on its store yet, so there is no buy or download link. PN Scripts does not take payment for it here.
The gap
Simple save code writes straight over the only copy of the player's progress, cannot tell a damaged file from a good one, and breaks old saves as soon as the data classes change.
What it is
Stashwright writes atomically, checksums every payload, keeps rotating backups and recovers from them, and upgrades old saves through explicit JSON migrations, behind an async slot API.
How you use it
Players do not lose progress to a crash or a damaged file, and you can change your save data between updates without breaking old saves.
A compact, source-included save layer for Unity developers who want crash-safe, versioned saves without adopting a large data framework.
Use it when
Built for
Each slot is one JSON file with a format marker, the slot name, the save version, a UTC time, a sequence number, your metadata (area, level, playtime), a SHA-256 checksum and the payload. ListSlotsAsync reads only these headers, newest first, so a load menu can show every slot without loading or decrypting the data.
SaveAsync writes to slot.save.tmp, flushes it to the physical disk and renames it over the slot. Before that, the current file is copied to slot.save.bak1 and older backups move down to the configured count. A write interrupted before the rename leaves the old save in place, and CleanUpInterruptedWrites removes the leftover temp file.
Loading checks the envelope, the slot name, the checksum and, for encrypted saves, the HMAC. A rejected file is reported with its reason, the newest good backup is used and written back as the slot, and the result says RecoveredFromBackup. If every copy is bad the result is Corrupt and nothing is overwritten.
Raise the save version when your data changes and register one migration per step; each receives the raw JSON and returns the upgraded JSON, and the result reports the path, for example 1, 2, 3. Encryption is optional: AES-256-CBC with a fresh salt and IV per save, HMAC-SHA256 over the ciphertext, and keys from your passphrase with PBKDF2-SHA256. It stops casual editing; a key inside a build can be extracted.
1 of 5
| Platform or runtime | Supported versions | Tested up to |
|---|---|---|
| .NET (core library) | netstandard2.1 or newer | .NET 8.0 |
| Unity | 2021.3 or newer | compiled against 6000.5.4, not run |
It is finished and tested. It is not on sale yet; this page will say where to get it when it is.
Coming soon
Not published on its store yet, so there is no buy or download link. PN Scripts does not take payment for it here.