Game Updates
This guide is for programmers. It explains how to change your game after release without breaking the saves your players already have.
Shipready plans for updates in three ways:
- Every save records which version of your save data it holds.
- Small migration steps that you write upgrade old saves one version at a time.
- Loading is tolerant, so most changes need no migration at all.
The rules in short #
- Ship your first release with Save Version 1. It is in the settings asset
ShipreadySaveSettings, under Game updates. - When an update changes saved data in a way that old saves cannot handle by themselves, raise Save Version by one. Then write one migration step from the previous version.
- Keep every step you have ever written. A save from version 1 passes through every step on its way to the current version.
- Never lower Save Version after a release.
- Test every release with real save files from the versions you shipped before.
Settings in bold, such as Save Version, are fields on the settings asset. Select the asset in the Project window to change them.
What the save version is #
Every save file starts with a header like this one:
"header": { "saveVersion": 3, "gameVersion": "1.2.0", "kitVersion": "1.0.0",
"savedUtc": "2026-11-02T18:41:07Z", "checksum": "crc32:5F1A9C02", "packing": "readable" }
saveVersionis the Save Version of the build that wrote the file. This is the number Shipready acts on.gameVersionis Version from Project Settings → Player (Application.version). It is recorded for your information. Shipready never decides anything from it.kitVersionis the version of Shipready that wrote the file.packingsays how the data was stored:readable,gzip,aesorgzip+aes.
When Shipready reads a file, it compares the file's saveVersion with the build's Save Version:
| The file's version is | What happens |
|---|---|
| The same | The file loads as it is. |
| Older | The migration steps run, in order, and then the file loads. |
| Newer | The load is refused with NewerVersion, and the file is left untouched. |
Save Version has to be a whole number of 1 or more. Otherwise Shipready refuses to start (see SK123).
When to raise the save version #
Raise it only when old saves need help. Every version in the chain needs a step, even an empty one, so an unneeded raise just means an unneeded step.
| What your update changes | Raise Save Version? |
|---|---|
Adds a new value, a new ISaveable value or a newly ticked field |
No. Old saves do not hold it, so it keeps its default. |
| Adds a new object with a Saveable to a scene | No. It keeps its scene defaults. |
| Deletes a saved object from a scene | No. Its saved state is skipped and reported. |
| Reorders enum values or adds new ones | No. Enums are saved by name. |
| Renames or moves a scene | No. The Scene Registry knows scenes by their permanent ID. |
| Turns compression or encryption on or off | No. Each file records how it was packed. |
Renames a value, a ticked field, an ISaveable component class or a category |
Yes |
| Changes what a value means, its type or its units (for example 0 to 100 becomes 0 to 1) | Yes |
| Moves a value from one category to another | Yes |
| Renames an enum value | Yes. The old name no longer matches, so the default would be used. |
| Needs old saves to start a new value differently from new games | Yes |
| Drops a value you no longer use | Only if you want it gone, or if a new value will reuse its name. Otherwise it is simply ignored. |
Writing a migration step #
A migration step is a static method marked [SaveMigration(fromVersion: N)]. It upgrades a save from version N to version N + 1. It receives the whole save as a SaveTree and edits it, so it never needs your old classes.
using RareGeometry.Shipready.Save;
public static class SaveMigrations
{
// Turns a version 1 save into a version 2 save.
[SaveMigration(fromVersion: 1, Description = "cash renamed to money")]
static void RenameCashToMoney(SaveTree save)
{
save.RenameKeyEverywhere("cash", "money");
}
}
A step must follow these rules. When Shipready starts, it warns in the Console about any step it ignores.
- Its shape:
static, returnsvoid, takes exactly one parameter of typeSaveTree, and is not generic. It may be public or private, in any class, including a nested class. - Its number:
fromVersionis the version the step upgrades from, starting at 1. A step marked 3 turns a version 3 save into a version 4 save. - Its name:
Descriptionis optional. Reports and the Console use it to name the step. Without it they useClassName.MethodName. - It ships with the game. Do not put it in an
Editorfolder or an Editor-only assembly, because builds leave those out. - Its assembly must be one Shipready searches. When Shipready looks for steps, it skips the assemblies of .NET, Mono, Unity and NUnit: those called exactly
System,mscorlib,netstandard,UnityEngineorUnityEditor, and those whose names start withSystem.,Unity.,UnityEngine.,UnityEditor.,Mono.ornunit.. So do not give your own assembly definition a name such asUnity.SavesorSystem.Gameplay. Names such asSystems.Gameplay,UnityExtrasorMyGame.Saves, and the defaultAssembly-CSharp, are searched. - Discovery is on. Auto Discover Migrations (under Game updates) is on by default, so Shipready finds steps every time it starts. If you switch it off, add your steps by hand.
Adding steps by hand #
You can register a step in code instead of marking a method, with SaveKit.Migrations.Add. Add it before Shipready starts: Shipready loads the global file while it starts, and that file may need the step too. Shipready starts by itself just before the first scene loads, so add your steps in a static method that Unity runs earlier, marked AfterAssembliesLoaded:
using RareGeometry.Shipready.Save;
using UnityEngine;
public static class HandAddedMigrations
{
// Runs in every Play session and every build, before Shipready starts by itself.
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
static void AddSteps()
{
SaveKit.Migrations.Add(1, save => save.RenameKeyEverywhere("cash", "money"), "cash renamed to money");
}
}
With Initialise Automatically switched off, you can instead add the steps just before your own SaveKit.Initialise() call.
- A step added by hand always wins over a
[SaveMigration]step for the same version, whichever was registered first. SaveKit.Shutdown()forgets the steps added by hand, and so does the start of every Play session. Add them again before Shipready starts again; the method above does that by itself.- A step added after Shipready has started still applies to every later load and save, but the global file was already loaded without it. If that file needed the step, it failed to load with a warning and the Global categories started empty;
SaveKit.LoadGlobal()loads it again. - Code stripping never removes a step added by hand, because your code calls it.
The SaveTree helpers #
A step gets the whole save:
save.Dataholds one member per category, such asProgressorWorld.save.Infoholds the slot info that the menu shows.save.Headerholds the header. Shipready raises itsSaveVersionafter each step, so leave it alone.
Most changes need only these helpers. Each one does nothing when the key or category is missing, so it is safe on every kind of save file.
| Helper | What it does | Returns |
|---|---|---|
RenameKeyEverywhere(from, to) |
Renames every value called from, at any depth, in every category |
How many it renamed |
RemoveKeyEverywhere(name) |
Removes every value called name, at any depth |
How many it removed |
AddDefaultBeside(besideName, name, value) |
Wherever a value called besideName exists and name does not, adds name with a copy of value |
How many it added |
RenameCategory(from, to) |
Renames a category and keeps everything in it | true when it renamed one |
FindPath(path) |
Follows a path such as Progress/stats/health from the data root. In a list, a number picks the item |
The value, or null |
There are more for anything the helpers do not cover: GetCategory, HasCategory, RemoveCategory and VisitAll, which walks every value.
Renaming onto a name that already exists replaces that value. Values in the tree are SaveNodes. Make new ones with ValueConverters.From(...), which writes numbers in Shipready's fixed format. Read them with ValueConverters.ToInt32(node, fallback) and the matching methods for other types. Both live in the namespace RareGeometry.Shipready.Save.Data.
using RareGeometry.Shipready.Save;
using RareGeometry.Shipready.Save.Data;
public static class HelperExamples
{
// Not a real step: each line shows one helper.
static void Examples(SaveTree save)
{
// "cash" is now called "money".
save.RenameKeyEverywhere("cash", "money");
// The hint system was removed.
save.RemoveKeyEverywhere("lastHint");
// New games start with tutorialDone = false, but players with an old save
// have finished the tutorial already.
save.AddDefaultBeside("money", "tutorialDone", ValueConverters.From(true));
// The Quests category is now called Journal.
save.RenameCategory("Quests", "Journal");
// Health was a whole number from 0 to 100 and is now a fraction from 0 to 1.
SaveNode stats = save.FindPath("Progress/stats");
if (stats != null && stats.IsObject && stats.HasMember("health"))
{
int oldHealth = ValueConverters.ToInt32(stats.GetMember("health"), 100);
stats.SetMember("health", ValueConverters.From(oldHealth / 100f));
}
}
}
RenameKeyEverywhere and RemoveKeyEverywhere really do work everywhere. If a common name such as count appears in several places, edit just the one you mean with FindPath.
Where your values are in the tree #
The easiest way to find a path is to open a readable save in a text editor. In the Editor and in development builds the file is indented, so it is easy to read.
| Saved with | Path from the data root |
|---|---|
SaveKit.Data.Set("gold", gold, "Progress") |
Progress/gold |
| A field ticked in the Field Picker | <category>/scenes/<scene id>/objects/<object id>/fields/<Component>.<field>, for example .../fields/Chest.isOpen |
An ISaveable component |
<category>/scenes/<scene id>/objects/<object id>/custom/<Component>/<name> |
| An object marked DontDestroyOnLoad | <category>/persistent/objects/<object id>/... |
| An object spawned at runtime | <category>/scenes/<scene id>/spawned/<number>/state/... |
| Per-player data in co-op | players/<player id>/<category>/<name> |
<category>for a Saveable is the category set on the component, which is World by default.<Component>is the component's class name. A second component of the same class on one GameObject gets a number, for exampleChest[1].
So renaming the ticked field isOpen to opened on a Chest component needs this:
using RareGeometry.Shipready.Save;
public static class ChestMigrations
{
[SaveMigration(fromVersion: 4)]
static void IsOpenBecomesOpened(SaveTree save)
{
save.RenameKeyEverywhere("Chest.isOpen", "Chest.opened");
}
}
Two more things to do with a field rename:
- In the script, add Unity's
[FormerlySerializedAs("isOpen")]to the renamed field, so scenes and prefabs keep their Inspector values. - Tick the new field in the Field Picker on every Saveable that used the old one. A tick remembers the field by name.
Per-player data and RenameCategory #
RenameCategory renames the category at the top of the data only. In a co-op save, each player's values sit under players/<player id>/<category>, so rename those as well:
using RareGeometry.Shipready.Save;
using RareGeometry.Shipready.Save.Data;
public static class CoopMigrations
{
[SaveMigration(fromVersion: 5)]
static void QuestsBecomeJournal(SaveTree save)
{
save.RenameCategory("Quests", "Journal");
SaveNode players = save.FindPath("players");
if (players == null || !players.IsObject) return;
for (int i = 0; i < players.MemberCount; i++)
{
SaveNode player = players.GetMemberAt(i);
if (player != null && player.IsObject) player.RenameMember("Quests", "Journal");
}
}
}
Also rename the category in the settings asset under Categories.
Renaming an enum value #
Enums are saved by name, so reordering an enum or adding values never breaks a save. Renaming a value does: the old name no longer matches, so the default comes back. Rewrite the old name in a step:
using RareGeometry.Shipready.Save;
using RareGeometry.Shipready.Save.Data;
public static class EnumMigrations
{
// Difficulty.Hard was renamed to Difficulty.Expert.
[SaveMigration(fromVersion: 6)]
static void HardBecomesExpert(SaveTree save)
{
save.VisitAll((name, node) =>
{
if (!node.IsObject) return;
SaveNode difficulty = node.GetMember("difficulty");
if (difficulty != null && difficulty.Kind == SaveNodeKind.String && difficulty.Text == "Hard")
{
node.SetMember("difficulty", ValueConverters.From("Expert"));
}
});
}
}
Order and gaps #
- Steps run in order. They start from the file's version and run one version at a time. A version 1 save in a version 4 build runs steps 1, 2 and 3, and each step sees the save as the step before left it.
- The whole chain is checked first. If any step is missing, nothing runs. The load returns
MigrationMissingand names the missing version, and the file is left untouched (see SK121). The player's save loads as soon as a build with the missing step ships. - Steps run wherever an old file is read: slots, autosaves, the quicksave and the global file. A save into an old file runs them too, so one file never holds a mix of two versions. That is why a step must cope with files that lack the category it edits. The global file, for example, usually holds only Settings.
- The report lists the steps. After a load,
loaded.Report.MigrationsRunlists the versions whose steps ran, lowest first.
Duplicates #
Each version should have exactly one step.
- If two
[SaveMigration]methods are marked for the same version, Shipready uses only the first one. It picks it in a fixed order: assembly name, then full class name, then method name, compared character by character. The Console warns and names both methods. - A step added with
SaveKit.Migrations.Addwins over every[SaveMigration]step for that version.
When a step fails #
- Nothing is half-changed. Steps work on a copy of the save. If a step throws an exception, the load returns
MigrationFailed, naming the step and the exception (see SK122). The file and the game's live data stay as they were. - Write tolerant steps. Check
FindPathandGetCategoryresults fornullbefore you use them. Prefer the helpers, which do nothing when a key is missing. - Steps run more than once. The same step runs on every load of an old file until that file is saved again, and on every slot. Keep it deterministic: the same input must always give the same output.
Steps run on a background thread #
Steps run on a background thread, together with the rest of the file work for that file. That is true for LoadAsync and SaveAsync, for autosaves, and for the blocking Load and Save too: those wait for the background work to finish, but the step itself still runs there. So a step must only edit the SaveTree. Inside a step, never touch:
- GameObjects, components or ScriptableObjects
Resources,PlayerPrefs,TimeorApplication- any other Unity API
If a step needs a value such as a price table, write that value into the step's code as a constant.
Saves from a newer version are refused #
If a file's saveVersion is higher than the build's Save Version, the load returns NewerVersion and leaves the file untouched (see SK120). This happens when a player goes back to an older build, for example through a beta branch or a rollback.
SlotInfo.IsFromNewerVersionistruefor such a slot. The save menu shows a "From a newer version" badge and does not load it.- A save of only some categories into that slot is refused.
- A save of every category replaces the newer file. The newer file is kept as the newest backup while Backup Count is above 0.
This is why Save Version must never go down after a release.
Tolerant loading: what needs no migration #
- Missing values use their defaults.
SaveKit.Data.Get("key", fallback)andSaveReader.Read(name, fallback)return the fallback when the save has no such value. A ticked field the save does not hold keeps its current value. A[Serializable]class is filled in place, so fields added to it keep their defaults. A slot category the file does not hold starts empty. - Objects deleted from a scene are skipped and reported. The load still succeeds. Each skipped object is listed in
Report.SkippedObjectsand in a warning (see SK130). - New objects keep their scene defaults. An object the save knows nothing about is left exactly as the scene set it up.
- Renamed or moved scenes still restore. The Scene Registry knows each scene by its Unity GUID and keeps the path only as a label. A scene that is deleted and created again gets a new GUID, so register it before you ship (see SK133).
- Prefabs and registered assets can be renamed or moved. They are known by GUID too. Deleting one, or recreating it, breaks the link (see SK131 and SK132).
- Enums are saved by name. Reordering an enum never changes what an old save means.
One thing does lose state: removing a Saveable and adding it again gives the object a new ID, so its old saved state is skipped.
To see what was skipped after a load:
using RareGeometry.Shipready.Save;
using UnityEngine;
public class LoadReportExample : MonoBehaviour
{
public async void LoadSlotOne()
{
LoadResult loaded = await SaveKit.LoadAsync(slot: 1);
if (!loaded.Success)
{
Debug.LogWarning(loaded.ToString());
return;
}
foreach (string skipped in loaded.Report.SkippedObjects) Debug.Log("Skipped: " + skipped);
}
}
Changing compression or encryption in an update #
Each file records how it was packed (packing in the header), and the loader follows the file, not the settings. That is why you can change these in an update without stranding old saves:
- File Options → Compress, Encrypt, Encrypt Slot Info and Pretty Print
- Backup Count, Checksum Policy and Automatic Fallback
- Use Slot Options For Global File and the packing options in Global File Options
- Giving the global file its own extension, such as
.local, or taking it away again. Shipready then loads whichever of the old and the new global file was written last, so players keep their settings, and the next save writes the new name.
The next save of each file uses the new options.
Some settings must never change after release:
| Setting | What goes wrong |
|---|---|
| Passphrase, Key Salt, Key Iterations | Encrypted saves can no longer be opened (SK106). Keep them even after you switch Encrypt off, because old encrypted files still need the key. If Key Salt is empty, the key also depends on Product Name. |
| Save Folder Name, Profile Folder, the file name patterns, File Options → File Extension, Company Name, Product Name | Shipready looks in another folder or for other names, so saves seem to disappear (SK100). With {profile} in Profile Folder, SaveKit.ProfileId must also stay the same for each player, so use an ID that never changes, such as a Steam ID. |
| Global File Options → File Extension, changed from one value to another | Shipready looks for the global file under the new name and under the slots' extension only, so the player's settings seem to reset. Switching it on or off is safe (see above). |
| Save Version (lowering it) | Existing saves look newer than the game (SK120). |
| Slot Count (lowering it) | The higher slots fall out of range (SK151). |
| Category names | Rename one only together with a RenameCategory step. |
IL2CPP and code stripping #
Nothing in your game calls a [SaveMigration] method directly. Shipready finds the methods by their attribute, which IL2CPP code stripping cannot see, so stripping could remove the very methods old saves need.
To prevent this, Shipready adds a link file to every player build. It lists each class that holds a [SaveMigration] method and tells the linker to keep those classes. The file is written to Temp/RareGeometry.Shipready.Save/MigrationLink.xml in your project and passed straight to the linker. Unity clears the Temp folder when the Editor closes, so nothing is added to your Assets folder. The build log confirms it:
[Shipready] Kept 2 migration type(s) from code stripping.
If the file cannot be written, the build log shows an error instead. Shipready's own tests run a migration in a Windows IL2CPP build with Managed Stripping Level set to High.
- The link file covers the scripts Unity compiles into the player:
Assembly-CSharpand your assembly definitions. - Steps inside a precompiled plugin DLL are not covered. List their classes in a
link.xmlof your own anywhere underAssets:
<linker>
<assembly fullname="MyGame.Saves">
<type fullname="MyGame.Saves.SaveMigrations" preserve="all" />
</assembly>
</linker>
- Steps added with
SaveKit.Migrations.Addneed nothing extra.
The pre-migration file stays as a backup #
A load never writes to the file. Until the player saves that slot again, the file on disk stays at its old version, and every load migrates it again.
The first save in the new version writes the upgraded file. The old file becomes slot_01.save.bak1, provided Backup Count is 1 or more. It then moves down one place with each later save, and it is deleted once more than Backup Count saves have followed. A step with a bug can therefore be caught while the original data still exists, but only for a few saves. Test before you release.
Testing with old save files #
1. Keep real saves from every version you release. Before you raise Save Version, copy a few saves from the save folder into your project's repository: an early-game slot, a late-game slot, an autosave and global.save. A folder next to Assets, such as SaveFixtures/v1/, keeps Unity from importing them. Commit them to version control.
2. Try them by hand. Copy a fixture into the save folder and load it in Play Mode. Check the values, and check that loaded.Report.MigrationsRun lists the steps you expect. The Save Inspector (Tools → Shipready → Saves → Save Inspector) can import a file and open the save folder for you.
3. Test them automatically. An Edit Mode test with the Unity Test Framework can load a fixture into memory storage, so it never touches the real save folder. Add RareGeometry.Shipready.Save to the references of your test assembly definition.
using System.IO;
using RareGeometry.Shipready.Save;
using RareGeometry.Shipready.Save.Settings;
using RareGeometry.Shipready.Save.Storage;
using NUnit.Framework;
using UnityEngine;
public class OldSaveTests
{
[Test]
public void Version1SaveLoadsIntoThisVersion()
{
// A copy of your real settings: same save version, passphrase and categories.
SaveKitSettings settings = Object.Instantiate(SaveKitSettings.Load());
var storage = new MemorySaveStorage();
storage.SetFile(settings.GetSlotFileName(1), File.ReadAllBytes("SaveFixtures/v1/slot_01.save"));
Assert.IsTrue(SaveKit.Initialise(settings, storage).Success);
try
{
LoadResult loaded = SaveKit.Load(1);
Assert.IsTrue(loaded.Success, loaded.ToString());
Assert.AreEqual(4300, SaveKit.Data.Get("money", 0, "Progress"));
Assert.IsFalse(SaveKit.Data.Has("cash", "Progress"));
}
finally
{
SaveKit.Shutdown();
Object.DestroyImmediate(settings);
}
}
}
4. Try the demo. The Game Updates demo ships in Shipready's Samples folder as the scene GameUpdatesDemo, together with a version 1 save file, v1_example.save. Press Simulate update: the demo starts Shipready at save version 2 with a migration that renames cash to money, loads the old file, and shows the values before and after, along with the steps that ran.
Worked example: version 1 to version 3 #
Version 1 (shipped with Save Version 1) #
using System;
using RareGeometry.Shipready.Save;
[Serializable]
public class PlayerStats
{
public int health = 100;
}
public static class Version1Saving
{
public static void Store(int cash, PlayerStats stats, int lastHint)
{
SaveKit.Data.Set("cash", cash, "Progress");
SaveKit.Data.Set("stats", stats, "Progress");
SaveKit.Data.Set("lastHint", lastHint, "Quests");
}
}
The data in a version 1 save:
"data": {
"Progress": { "cash": 4300, "stats": { "health": 80 } },
"Quests": { "active": ["find_the_dog"], "lastHint": 3 }
}
Version 2 (Save Version 2) #
cashis renamed tomoney.- A new value,
tutorialDone, isfalsein a new game. Players who already have a save have finished the tutorial, so their saves should gettrue.
Version 3 (Save Version 3) #
- The Quests category is renamed to Journal, in the settings asset under Categories too.
- The hint system is removed, so
lastHintgoes. PlayerStats.healthbecomes afloatfrom 0 to 1 instead of a whole number from 0 to 100.
The steps in the version 3 build #
using RareGeometry.Shipready.Save;
using RareGeometry.Shipready.Save.Data;
public static class StarFarmMigrations
{
[SaveMigration(fromVersion: 1, Description = "money and tutorial")]
static void UpgradeTo2(SaveTree save)
{
save.RenameKeyEverywhere("cash", "money");
save.AddDefaultBeside("money", "tutorialDone", ValueConverters.From(true));
}
[SaveMigration(fromVersion: 2, Description = "journal, no hints, health as a fraction")]
static void UpgradeTo3(SaveTree save)
{
save.RenameCategory("Quests", "Journal");
save.RemoveKeyEverywhere("lastHint");
// The global file has no Progress category, so check before converting.
SaveNode stats = save.FindPath("Progress/stats");
if (stats == null || !stats.IsObject || !stats.HasMember("health")) return;
int oldHealth = ValueConverters.ToInt32(stats.GetMember("health"), 100);
stats.SetMember("health", ValueConverters.From(oldHealth / 100f));
}
}
What happens #
- A version 1 save loads in the version 3 build. Steps 1 and 2 run, and
loaded.Report.MigrationsRunis[1, 2]. - A version 2 save runs step 2 only. A version 3 save runs nothing.
- The global file runs both steps too. They change nothing in it, because it holds neither
cash,QuestsnorProgress.
The data after loading the version 1 save:
"data": {
"Progress": { "money": 4300, "stats": { "health": 0.8 }, "tutorialDone": true },
"Journal": { "active": ["find_the_dog"] }
}
A float is written with the fewest digits that read back as exactly the same float, so 0.8 shows as 0.8. A few values need more digits, up to nine.
The file on disk is still the version 1 file until the player saves. After that save, the slot holds version 3 data, and the version 1 file is kept as slot_01.save.bak1.
Something else not working? Every result code has an entry in Troubleshooting.