Shipready: API Reference
Version 1.0.0 · Rare Geometry · Generated 2026-10-30
Every public type and member of Shipready, generated from the documentation comments in its source code. 191 types and 2091 members in 25 namespaces.
For explanations, walkthroughs and examples, start with the Guide; for how each part works, the Reference. Every error code has an entry in Troubleshooting.
| Assembly | What it holds | Runs in |
|---|---|---|
RareGeometry.Shipready.Save |
Saving and loading, slots, files, backups, compression and encryption, world persistence, migrations and the co-op hooks | Game and Editor |
RareGeometry.Shipready.Save.UI |
The save and load menu, its theme and text assets, thumbnails and test hotkeys | Game and Editor |
RareGeometry.Shipready.Save.Editor.Core |
The core editor services, which need no UI package: saved ids for Saveables, registry upkeep, loading saved scenes outside Build Settings in the Editor, and the migration link file for builds | Editor only, never in a build |
RareGeometry.Shipready.Save.Editor |
The Setup Wizard, Save Inspector, Diagnostics, the Saveable inspector and Field Picker, and the generators. Needs uGUI and TextMesh Pro | Editor only, never in a build |
RareGeometry.Shipready.Save.Editor.Setup |
Install Required Packages, which installs uGUI and TextMesh Pro in a project that lacks them, and stops a player build until they are in. It compiles only while one of them is missing | Editor only, never in a build |
How to read this reference:
- Most game code needs only
using RareGeometry.Shipready.Save;. A type in another namespace shows its namespace under its name. - Signatures are C# as declared, including default values. Members are listed by name; enum values in declaration order. Inherited members are not repeated.
- Calls that can fail return a result (
SaveResultorLoadResult) with an error code, a plain-English message and a link to Troubleshooting. They do not throw.
Contents #
- RareGeometry.Shipready.Save
- AnimatorSaver · class. The Animator saver: an Animator's parameters (floats, ints and bools), and for each layer the state it is in, how far through it is, and the layer's weight.
- AudioSourceSaver · class. The Audio Source saver: whether an AudioSource is playing, how far into its clip it is, and its volume and pitch.
- AutosaveScheduler · class. Decides when an autosave is due.
- AutosaveTrigger · enum. Why an autosave is being asked for.
- DestroyedHandling · enum. What happens to a scene object that was destroyed during play when its scene comes back.
- EnabledSaver · class. The Enabled saver: the enabled tick box of the components you choose, such as a light, a renderer, a collider or one of your scripts.
- ISaveable · interface. Implemented by a component that writes and reads its own state.
- LoadResult · readonly struct. What a load call did.
- NavMeshAgentSaver · class. The NavMesh Agent saver: where a NavMeshAgent is, where it was walking to, its speed and whether it was stopped.
- PlaytimeTracker · class. Counts how long the player has played, so a slot card can show it.
- Saveable · class. Makes a GameObject part of the saved world.
- SaveActions · class. Saving and loading without code: drop this on any object, then pick one of its methods in a UI Button's On Click list (or any UnityEvent): Save To Slot, Load Slot, Quicksave, Quickload, Autosave, Continue, New Game, Delete Slot or Delete All Saves.
- SaveActions.StringEvent · class. A UnityEvent that carries a line of text.
- SaveData · class. The plain values a game saves: gold, the current day, a volume setting, a list of unlocked levels.
- SavedField · class. One field ticked in a Saveable's Field Picker: a component on the same GameObject and the name of one of its Inspector fields.
- SaveErrorCode · enum. Every outcome Shipready can report.
- SaveErrorInfo · static class. Turns a
SaveErrorCodeinto the three things a developer needs: a stableSKidentifier, a plain-English message and the place in the bundled documentation that explains it. - SaveEventInfo · struct. What an event is telling the game about.
- SaveEventListener · class. Shipready's save and load events as UnityEvents, so a sound, an animation or a message can follow a save without code: drag an object into a list and pick what it does.
- SaveEvents · static class. The points a game can hook into: a save or load starting, finishing, or finishing by falling back to a backup.
- SaveFileKind · enum. What a save file is to the game.
- SaveKit · static class. The front door.
- SaveKitAutoStart · static class. Starts Shipready by itself when the game runs, just before the first scene loads, so a game set up with the Setup Wizard can save and load without a line of code.
- SaveKitEnvironment · static class. The handful of Unity values Shipready needs while it is working on a background thread.
- SaveKitRunner · class. The one hidden object Shipready keeps in a running game.
- SaveKitVersion · static class. Version numbers Shipready stamps into every save file and reports in the Editor.
- SaveMigrationAttribute · class. Marks a static method as the step that upgrades a save from one version to the next.
- SavePoint · class. A checkpoint: saves when the player walks into its trigger, or when a UnityEvent calls
SaveNow(), with a cooldown so walking back and forth does not save every step, and an "only once" option. - SavePointTarget · enum. What a
SavePointwrites. - SaveReader · class. What a game reads its state out of.
- SaveResult · readonly struct. What a save, delete or verify call did.
- SaveTree · class. One whole save, in memory: its header, the slot info the menu shows, and the game data split into categories.
- SaveWorld · class. The saved world: scene memory, the scene loader, and the hooks a pool or a custom scene loader needs.
- SaveWriter · class. What a game writes its state into.
- SlotIndex · class. A small cache of what each slot holds, so a menu with ninety-nine slots does not have to open ninety-nine files to draw itself.
- SlotInfo · class. What the save menu shows about one slot, and what Shipready records about it.
- ThumbnailCapture · static class. Takes the picture a slot card shows: a camera renders the game once into a small temporary texture, which is read back.
- Thumbnails · static class. The small picture a slot card shows.
- WorldLoadMode · enum. How a load treats scenes.
- RareGeometry.Shipready.Save.Codecs
- AesHmacCodec · static class. Optional encryption for the data section of a save: AES-256 in CBC mode with a fresh random starting block for every write, and an HMAC-SHA256 signature over the header and the encrypted bytes.
- GzipCodec · static class. GZip compression for the data section of a save.
- KeyDerivation · static class. Turns a developer passphrase into encryption keys, once per run.
- SaveKeys · class. The two keys an encrypted save needs: one to encrypt with and a separate one to sign with.
- RareGeometry.Shipready.Save.Coop
- IPlayerIdentity · interface. Maps a connected player to a stable id string that survives the player leaving and coming back, such as a Steam ID.
- ISaveAuthority · interface. Decides who may save and load world data.
- ISpawnHandler · interface. Creates and removes runtime objects for Shipready.
- PlayerData · class. Per-player data in a co-op game: position, inventory, anything that belongs to one player rather than to the world.
- RareGeometry.Shipready.Save.Data
- SaveNode · class. One node of the save tree, which is Shipready data model that everything else reads: the JSON writer and reader, the menu, the Save Inspector, Diagnostics and migrations.
- SaveNodeKind · enum. What one node in a save tree holds.
- ValueConverters · static class. Turns the supported value types into save tree nodes and back.
- RareGeometry.Shipready.Save.Diagnostics
- PlayModeToast · class. The Editor's Play Mode toast: a short note at the top of the Game view after each save or load, such as "Saved Slot 1: 12 objects, 3 values".
- SaveFileCopy · enum. Which copy of a save file was read.
- SaveLog · static class. The one place Shipready writes to the Console.
- SaveLogLevel · enum. How much Shipready writes to the Console.
- SaveOperation · enum. Which operation a report describes.
- SavePacking · enum. How the data section of a file is packed.
- SaveProfilerMarkers · static class. The names of the Profiler markers Shipready wraps around each stage of a save and a load, so every stage shows up in Unity's Profiler, on the thread it ran on.
- SaveReport · class. What one save or load actually did: how long each stage took, how much was written and anything worth a warning.
- SaveToastText · static class. The one-line text of the Editor's Play Mode toast after a save or a load, for example "Saved Slot 1: 12 objects, 3 values" or "Loaded Slot 1: 11 restored, 1 skipped, Chest_02 not found (SK130).
- SaveWarning · struct. One thing a save or load wants to flag without failing the call.
- RareGeometry.Shipready.Save.Files
- AtomicFileWriter · static class. Writes a save file so that a crash can never leave a player without one.
- AtomicWriteOutcome · struct. What writing a save file did.
- AtomicWriteStep · enum. The steps of a crash-safe write, in the order they run.
- BackupRotator · static class. Keeps the rotating backups for one save file.
- Checksum · static class. The checksum written into every save header and verified on every load.
- EnvelopeReadOutcome · struct. What reading an envelope produced.
- EnvelopeWriteOutcome · struct. What writing an envelope produced.
- RecoveryAttempt · struct. One copy of a save that the recovery loader tried, and how it went.
- RecoveryLoader · static class. Reads a save, falling back through every copy Shipready keeps until one works.
- RecoveryOutcome · struct. What reading a save, with recovery, produced.
- SaveEnvelope · static class. The file format.
- SaveFileNames · static class. The naming rules for everything Shipready writes.
- SaveFileReadResult · struct. What reading one save file produced.
- SaveFileStatus · class. What one save file looks like on disk, for the Save Inspector: whether it reads, how it is packed, which save version wrote it and how many backups it has.
- SaveFileStore · class. One save file, read and written safely.
- SaveHeader · class. The bookkeeping at the front of every save file: which envelope format it uses, which save version the game was on, when it was written, how it is packed, and the checksum that proves it is intact.
- SaveMergeJob · abstract class. Builds the save to write from the copy already on disk, for
SaveFileStore.WriteMerged(string, SaveMergeJob)andSaveFileStore.WriteMergedAsync(string, SaveMergeJob). - RareGeometry.Shipready.Save.Json
- JsonTextReader · static class. Reads JSON back into a save tree.
- JsonTextWriter · static class. Writes a save tree as JSON.
- JsonUtilityBridge · static class. Saves a developer own
[Serializable]class or struct by handing it to Unity and then folding the result into the save tree. - RareGeometry.Shipready.Save.Migration
- MigrationOutcome · struct. What running the migration steps did.
- MigrationRunner · class. Runs the migration steps that bring an old save up to the version the game is on.
- RareGeometry.Shipready.Save.Settings
- ChecksumPolicy · enum. What Shipready does when a readable save no longer matches its own checksum.
- PrettyPrintMode · enum. When Shipready indents a readable save file.
- SaveCategory · class. One named group of saved values.
- SaveCategoryScope · enum. Where the values in a category are kept.
- SaveFileOptions · class. How save files are written: readable or packed, how many backups to keep, the extension, and what to do about a file that has been edited.
- SaveKitSettings · class. Every choice a game makes about saving, in one asset.
- RareGeometry.Shipready.Save.Storage
- FileSaveStorage · class. Save files on the local disk, under a folder inside
Application.persistentDataPath. - ISaveStorage · interface. Where save files live.
- MemorySaveStorage · class. Save files held in memory.
- StorageOutcome · struct. What one storage call did.
- RareGeometry.Shipready.Save.World
- FieldSaver · static class. The Field Picker saver: saves the Inspector fields ticked on a Saveable.
- ISceneLoader · interface. Loads scenes for Shipready, for a game that starts its scene loads its own way, such as scenes that are not in Build Settings or a load that also shows a loading screen.
- RareGeometry.Shipready.Save.World.Registries
- AssetReferences · static class. Where Shipready looks up assets while saving and loading.
- AssetRegistry · class. Every asset a save may point at, such as ScriptableObject item definitions, under a permanent id: the asset's Unity GUID.
- IAssetReferenceSource · interface. Turns an asset into an identifier that survives a save, and back again.
- PrefabRegistry · class. Every prefab Shipready can re-create on load, under a permanent id: the prefab asset's Unity GUID.
- SceneRegistry · class. Every scene Shipready saves, under a permanent id: the scene asset's Unity GUID, with its path as a label.
- RareGeometry.Shipready.Save.UI
- ConfirmDialog · class. The yes-or-no question the menu asks before anything that cannot be undone: overwriting a save, loading over unsaved progress, deleting.
- DisplayAs · enum. How a message or state shows to the player: in words, as an icon, both, or not at all.
- GameMenu · class. A title screen or pause menu that needs no code: Continue (the newest save of any kind, greyed out when there is none), New Game, Save Game and Load Game (they open your
SaveMenu), Delete All Saves and Quit. - HotkeysActiveIn · enum. Where the test hotkeys of
SaveMenuHotkeyswork. - IndicatorCorner · enum. Which corner of the screen the
SavingIndicatorsits in. - ISaveMenuConfirmation · interface. Your own confirmation for the save menu's questions ("Overwrite Slot 2?", "Load Slot 1?", "Delete Slot 3?"), in place of Shipready's
ConfirmDialog. - ISaveMenuNamePrompt · interface. Your own name box for the save menu's player-named saves and Rename, beside your own
ISaveMenuConfirmation. - MenuCancelRelay · class. Passes Cancel (Escape, or East on a gamepad) from the EventSystem to the menu.
- MenuInputBridge · class. Reads the few keys the menu needs outside the EventSystem, from whichever input system the project uses: the old Input Manager, the Input System package, or both.
- MenuLayout · class. How the save menu is laid out: a list or a grid of cards, how tall a card is, which details a card shows, where the panel sits and how wide it is, and whether the title and the dimmed backdrop show.
- MenuPlacement · enum. Where the save menu's panel sits on the screen.
- MenuText · class. Every word the save menu shows, in one asset, so translating the menu needs no extra package: duplicate
DefaultMenuText, translate the copy and assign it to the menu (SaveMenu.Text), or swap assets when the player changes language. - MenuTheme · class. How the save menu looks: every colour, the font, the font sizes, the corner radius and the spacing, in one asset.
- MenuThemeRole · enum. What a piece of the menu is, which decides the colours, font size and shape the theme gives it.
- MessageIcons · static class. Shipready's built-in icons, one for each
MessageKind: a spinner for saving and loading, a tick for saved, a document with a crack for damaged, a padlock, two people for co-op, and so on. - MessageKind · enum. The kinds of message Shipready shows the player.
- MessageKindLook · class. One kind of message's own settings in a theme: its icon (empty uses Shipready's built-in icon) and, when ticked, a display of its own that every part of Shipready uses for it.
- MessageLook · class. How Shipready's messages look, on the
MenuTheme(MenuTheme.Messages): how each part shows its messages (DisplayAs), where the saving indicator and the save notes sit, the colour of each state and each kind's icon. - MessageSurface · enum. What a
MessageViewsits on. - MessageView · class. Shows one message the way the theme asks (
DisplayAs): its full or short words, its icon (plain or in the state's colour), both, or nothing. - OrientationScaler · class. Sits beside a kit canvas's Canvas Scaler and picks its reference size for the screen: the 1920×1080 design on a wide screen, and on a screen held upright (with the layout's
MenuLayout.Portraiton Auto or Custom) a narrow one, so a phone gets words and buttons it can read and press. - PortraitLayout · enum. How Shipready's menus lay out on a screen held upright (taller than wide), such as a phone.
- RoundedSprites · static class. Makes the rounded shapes the menu is drawn with, so Shipready ships no sprite assets: a filled rounded rectangle and a rounded outline for any radius, as small 9-sliced sprites with anti-aliased corners.
- SafeAreaPanel · class. Keeps a panel inside the screen's safe area: clear of a phone's notch, rounded corners and the home bar, and of a TV's overscan.
- SaveMenu · class. The player's save and load menu: one prefab, two modes.
- SaveMenuHotkeys · class. Test hotkeys for the save menu: F5 opens it in Save mode and F9 in Load mode, and the same key again closes it.
- SaveMenuMode · enum. Which job the save menu is doing: the same prefab saves and loads.
- SaveMenuTab · enum. Which saves the Load menu's tabs show.
- SaveNotes · class. A short note to the player when a load finished ("Game loaded"), when a save came back from its backup, or when a save or a load did not work, shown for a moment at the edge of the screen.
- SavingIndicator · class. A small "Saving..." with a turning icon at the edge of the screen while a save runs, then "Saved" (or "Save failed") for a moment before it fades out.
- SavingIndicator.State · enum. What the indicator is showing.
- ScreenPlacement · class. Where a message box sits: one of six places on the screen's edges, or any point of it, and how far in from the edge.
- ScreenPosition · enum. Where on the screen a message box sits.
- SlotCard · class. One save in the menu's list: its thumbnail on the left; its name, badges, date, playtime, location and first two summary lines in the middle; its buttons on the right.
- SlotListLayout · class. Lays the save menu's cards out as a list (one column) or as a grid of tiles (two to four columns).
- SlotListScroller · class. Keeps the selected entry of a scrolling list in view.
- ThemedElement · class. Gives one piece of the menu its look from a
MenuTheme: the colour and rounded shape of an image, the colours of a button and its label, or the font, size and colour of a label. - RareGeometry.Shipready.Save.Editor
- KitLinks · static class. Every web address and the e-mail address Shipready shows, in one place: the editor tools' help buttons read them from here, and
tools/fill-placeholders.ps1reads this file to write them into the documents, in place of the WEBSITE, SUPPORT_REPO, ISSUE_FORM, DISCUSSIONS, DISCORD and SUPPORT_EMAIL placeholders and of the values it wrote last time. - RareGeometry.Shipready.Save.Editor.Build
- MigrationLinkXmlBuilder · class. Keeps migration steps alive through code stripping.
- RareGeometry.Shipready.Save.Editor.Common
- SceneLoadingHooksInstaller · static class. Lets Shipready's default scene loader open, in the Editor, a saved scene that is not in Build Settings, so a scene being tested before it is added there still loads and restores with
SaveKit.LoadAsync. - RareGeometry.Shipready.Save.Editor.Registries
- RegistryUpkeep · static class. Keeps the Prefab, Asset and Scene Registries in step with the project, and keeps the Saveable ids on prefab assets right.
- RegistryUpkeepResult · class. What one run of
RegistryUpkeepchanged: prefab assets whose Saveable ids were put right, and registry entries added, updated or removed. - SaveableDuplicateScan · static class. Keeps every Saveable in the open scenes on its own id while you edit.
- SaveableEditorHooksInstaller · static class. Connects the
Saveablecomponent to the Editor. - RareGeometry.Shipready.Save.Editor.Diagnostics
- DiagnosticCheck · enum. The checks Diagnostics runs.
- DiagnosticIssue · class. One problem Diagnostics found: which check found it, how serious it is, a plain-English message naming the object, the object or asset it is about, the matching error code, and a one-click fix where one is safe.
- DiagnosticSeverity · enum. How serious a Diagnostics issue is.
- DiagnosticsResult · class. What one Diagnostics run found: every issue, most serious first, and how much was checked.
- DiagnosticsRunner · static class. Runs every Diagnostics check over a
DiagnosticsScopeand hands back the issues found, each with a plain-English message and, where it is safe, a one-click fix that is recorded for Undo. - DiagnosticsScope · class. What Diagnostics looks at.
- DiagnosticsWindow · class. The Diagnostics window: runs every check over the chosen scope and lists what it finds, most serious first, each with a plain-English message, the object it is about and a one-click fix where one is safe.
- RareGeometry.Shipready.Save.Editor.Drawers
- FieldPickerModel · class. The Field Picker of one
Saveable, without any drawing: one row per field Unity serializes on each component of the GameObject, whether it can be ticked, and why not when it cannot. - FieldPickerRow · class. One field in the Field Picker: a field Unity serializes on one component of the Saveable's GameObject, whether Shipready can save it, why not when it cannot, and whether it is ticked.
- SaveableEditor · class. The Inspector of a
Saveable: a one-sentence summary of what it saves, the built-in savers with a one-line explanation each, and the Field Picker, where the fields of the other components on the object are ticked to be saved. - SaveableSummary · static class. The one sentence at the top of a Saveable's Inspector that says what it saves, for example "Saves position, active state and 2 fields: Is Open, Gold".
- SaveKitSettingsEditor · class. The Inspector of Shipready's settings asset, in two tabs.
- StartAssignmentScan · static class. A quick look through a script's source for fields that its
Startmethod sets. - RareGeometry.Shipready.Save.Editor.FirstRun
- BugReport · static class. Report a Bug: copies a ready-to-paste report to the clipboard (kit, Unity and pipeline versions, platform, the last three saves and loads, and Diagnostics' issues), and the Start window's Help and support page shows the bug report form's address, with the fields it can fill already filled, to copy.
- BugReportFacts · class. What a bug report says about the project, gathered by
BugReport.Gather(bool). - DemoTextCheck · static class. The demos' text uses TextMesh Pro.
- FirstRunCheck · enum. The things the Start window checks before a first save can work.
- FirstRunStatus · static class. Works out the Start window's status strip from what the Editor reports: settings found, scene saved, scene in Build Settings, hotkeys on and the menu's text resources.
- FirstRunStatusItem · class. One check of the Start window's status strip, with its fix.
- PlayModeToasts · static class. Switches the Play Mode toast on and off, and adds it to the Game view at the start of Play Mode.
- StartWindow · class. The Start window: the first thing a new buyer sees.
- StartWindow.Flow · enum. The guided flows the Start window offers.
- StartWindowAutoOpen · static class. Opens the Start window once, the first time the Editor loads Shipready in a project.
- RareGeometry.Shipready.Save.Editor.Generators
- DemoSceneGenerator · static class. Builds the four demo scenes and everything they use, in
Samples/Demos: the scenes (QuickStartDemo,WorldDemo,WorldDemo_Cellar,GameUpdatesDemo,RecoveryDemo), the crate prefab and the four on-screen panel prefabs, one settings asset per demo with the demo Prefab, Asset and Scene Registries, and the version 1 example save, written through Shipready itself. - MenuPrefabGenerator · static class. Builds the player menu's prefabs and its default theme and text assets:
SaveMenu,SlotCardandConfirmDialoginUI/Prefabs,DefaultMenuThemeandDefaultMenuTextinUI/Settings. - MenuStyleGenerator · static class. Writes the six ready-made menu styles (
MenuStylePresets) as theme assets inUI/Settings/Styles. - RareGeometry.Shipready.Save.Editor.Inspector
- SaveInspectorFile · class. One save in the Save Inspector's list: the main file name, its status, and the other copies that belong to it (backups, a half-written temporary file, damaged copies kept for support).
- SaveInspectorModel · class. Everything the Save Inspector does, without drawing anything: it lists the saves in a folder with their status, opens one (or one of its backups) as a searchable tree, highlights the live object a tree row belongs to, shows what a save would write right now in Play Mode, and imports, exports, restores and deletes saves.
- SaveInspectorWindow · class. The Save Inspector: every save in the save folder with its status, any save (or backup) opened as a searchable tree, the live view of what a save would write in Play Mode, the recent save and load reports, and import, export, restore, delete and open-folder actions.
- SaveTreeNode · class. One row of the Save Inspector tree: file, category, scene, object or value.
- SaveTreeNodeKind · enum. What a row of the Save Inspector tree stands for.
- SaveTreeView · class. An opened save as a flat, searchable tree: file, then header and slot info, then each category, scene, object and value.
- RareGeometry.Shipready.Save.Editor.MenuStyle
- MenuPreview · class. Draws the save menu with made-up saves into a picture, for the Menu Style window.
- MenuStyleModel · static class. What the Menu Style window does, without the window: finds the save menu in a scene or adds one, makes the game's own copy of the menu's theme and wording in the data folder, applies a ready-made style, saves the wording, and exports and imports a whole style as a
.jsonfile. - MenuStylePreset · class. One ready-made look for the save menu: every colour, the sizes and the shape.
- MenuStylePresets · static class. The six ready-made looks of the save menu: Dark (the default), Light, Fantasy, Sci-fi, Cozy and Minimal.
- MenuStyleWindow · class. Tools > Shipready > Menu Style: makes the save menu in the open scene look and read the way the game wants, without the Project window, a prefab or code.
- MenuTextField · class. One line of the menu's wording, as the Words tab shows it.
- MenuTextFields · static class. Every line of the menu's wording (
MenuText) in the groups the Words tab shows, with what{0}means where the menu fills it in, and a check that says when a line would show wrongly. - MessageNames · static class. The plain names the editor's pickers show for the message choices.
- RareGeometry.Shipready.Save.Editor.Wizard
- GamePreset · enum. A kind of game the settings can be set up for in one click.
- GamePresetChange · class. One setting a game preset changes, with its value before and after, in plain words.
- GamePresets · static class. Settings for common kinds of game, applied in one click from the Setup Wizard's first page or the settings' Basics tab.
- SaveableSuggestion · class. One object the Setup Wizard's scene scan thinks should remember its state, with the reason in plain English.
- SetupWizardModel · class. Everything the Setup Wizard does, without drawing anything: the choices of each step, and one Apply per step that writes them into the project.
- SetupWizardWindow · class. The Setup Wizard: two short steps, where saves go and the menu with its test hotkeys, then a list of everything it created or changed.
- TmpEssentials · static class. TextMesh Pro's essential resources (its default font and settings), which the save menu's text needs.
- RareGeometry.Shipready.Save.Editor.Setup
- RequiredPackages · static class. Tells the developer which Unity packages Shipready's save menu, editor tool windows and demos need, and how to install them: uGUI (
com.unity.ugui) and TextMesh Pro, which is part of uGUI from Unity 2023.2 and the separatecom.unity.textmeshpropackage in Unity 2022.3.
Namespace RareGeometry.Shipready.Save #
AnimatorSaver #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class AnimatorSaver : MonoBehaviour, ISaveable
The Animator saver: an Animator's parameters (floats, ints and bools), and for each layer the state it is in, how far through it is, and the layer's weight. Add it beside a Saveable; no code. A door saved half open comes back half open, a character saved crouching comes back crouching.
Triggers are not saved: they last one moment and would fire again on load. A layer in the middle of a blend is saved as the state it is blending into. The state comes back once the Animator is ready, on its first frame after the load, so an object loaded inactive takes it when it is switched on.
Add Component menu: Shipready → Savers → Animator Saver
Properties
Animator
public Animator Animator { get; set; }
The Animator saved. Null uses the one on this object.
HasPendingRestore
public bool HasPendingRestore { get; }
Whether a load has handed over state that the Animator has not taken yet.
SaveParameters
public bool SaveParameters { get; set; }
Whether the float, int and bool parameters are saved. On by default.
SaveStates
public bool SaveStates { get; set; }
Whether each layer's state, its progress and the layer weights are saved. On by default.
Methods
CaptureState(SaveWriter)
public void CaptureState(SaveWriter w);
Writes this component state. Called on the main thread, so every Unity API is available.
| Parameter | Description |
|---|---|
w |
The place to write values into. Never null. |
RestoreState(SaveReader)
public void RestoreState(SaveReader r);
Reads this component state back. Every read takes the value to use when the save does not hold that name, so a value added in a game update keeps its default and an old save still loads.
| Parameter | Description |
|---|---|
r |
The place to read values from. Never null, and may be empty. |
AudioSourceSaver #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class AudioSourceSaver : MonoBehaviour, ISaveable
The Audio Source saver: whether an AudioSource is playing, how far into its clip it is, and its volume and pitch. Add it beside a Saveable; no code. Music saved halfway through comes back halfway through, a radio switched off stays off.
The clip itself is not changed: the AudioSource keeps the clip it has in the scene. The state comes back as soon as the AudioSource can play, so an object loaded inactive takes it when it is switched on.
Add Component menu: Shipready → Savers → Audio Source Saver
Properties
HasPendingRestore
public bool HasPendingRestore { get; }
Whether a load has handed over state that the AudioSource has not taken yet.
SavePlayback
public bool SavePlayback { get; set; }
Whether playing and the time into the clip are saved. On by default.
SaveVolumeAndPitch
public bool SaveVolumeAndPitch { get; set; }
Whether the volume and pitch are saved. On by default.
Source
public AudioSource Source { get; set; }
The AudioSource saved. Null uses the one on this object.
Methods
CaptureState(SaveWriter)
public void CaptureState(SaveWriter w);
Writes this component state. Called on the main thread, so every Unity API is available.
| Parameter | Description |
|---|---|
w |
The place to write values into. Never null. |
RestoreState(SaveReader)
public void RestoreState(SaveReader r);
Reads this component state back. Every read takes the value to use when the save does not hold that name, so a value added in a game update keeps its default and an old save still loads.
| Parameter | Description |
|---|---|
r |
The place to read values from. Never null, and may be empty. |
AutosaveScheduler #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class AutosaveScheduler
Decides when an autosave is due. Each trigger is optional, and the Setup Wizard asks which ones a game wants.
The timer counts in unscaled time, so pausing the game by setting the time scale to zero does not stop autosaves, and it restarts after every autosave rather than drifting.
Constructors
AutosaveScheduler(SaveKitSettings)
public AutosaveScheduler(SaveKitSettings settings);
Builds a scheduler for a set of settings.
| Parameter | Description |
|---|---|
settings |
The settings holding the triggers and the interval. |
Properties
Enabled
public bool Enabled { get; set; }
Whether the scheduler is asking for autosaves at all. A game switches it off during a cutscene or a boss fight, and back on afterwards.
SecondsUntilNext
public float SecondsUntilNext { get; }
How long until the next timed autosave, in seconds.
Methods
Reset()
public void Reset();
Starts the timer again. Shipready does this after every timed or scene-change autosave, and after every successful load of a slot, an autosave or the quicksave, so the game never autosaves a moment after the player loaded.
ShouldAutosaveOnQuit()
public bool ShouldAutosaveOnQuit();
Whether quitting or being suspended should autosave.
Returns: true when the trigger is switched on.
ShouldAutosaveOnSceneChange()
public bool ShouldAutosaveOnSceneChange();
Whether a scene change should autosave.
Returns: true when the trigger is switched on.
TickTimer(float)
public bool TickTimer(float deltaSeconds);
Adds time and says whether a timed autosave is now due.
| Parameter | Description |
|---|---|
deltaSeconds |
How much unscaled time has passed. |
Returns: true when the game should autosave now.
AutosaveTrigger #
enum in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public enum AutosaveTrigger
Why an autosave is being asked for.
Values
| Name | Value | Description |
|---|---|---|
None |
0 |
Not triggered. |
Timer |
1 |
The timer ran out. |
SceneChange |
2 |
The game changed scene. |
Quit |
3 |
The game is quitting or being suspended. |
Manual |
4 |
The game asked for one directly. |
DestroyedHandling #
enum in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public enum DestroyedHandling
What happens to a scene object that was destroyed during play when its scene comes back.
Values
| Name | Value | Description |
|---|---|---|
Destroy |
0 |
It is destroyed again, as soon as its scene is restored. |
Disable |
1 |
It is switched off instead, so links to it stay valid. |
EnabledSaver #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class EnabledSaver : MonoBehaviour, ISaveable
The Enabled saver: the enabled tick box of the components you choose, such as a light, a renderer, a collider or one of your scripts. Add it beside a Saveable and drag the components into its list; no code. A lamp switched off stays off, a trap disarmed by switching off its collider stays disarmed.
Any component with an enabled tick box works: every Behaviour (scripts, lights, audio sources, UI), every Renderer and every Collider. When it is added, the list starts with the ones on this object. The order of the list is how the saved values are matched, so add new components at the end in a game update.
Add Component menu: Shipready → Savers → Enabled Saver
Properties
Targets
public List<Component> Targets { get; }
The components whose enabled tick box is saved, in the order their values are stored.
Methods
CanSave(Component)
public static bool CanSave(Component component);
Whether a component has an enabled tick box this saver can save.
| Parameter | Description |
|---|---|
component |
The component. |
Returns: true for a Behaviour, a Renderer or a Collider.
CaptureState(SaveWriter)
public void CaptureState(SaveWriter w);
Writes this component state. Called on the main thread, so every Unity API is available.
| Parameter | Description |
|---|---|
w |
The place to write values into. Never null. |
RestoreState(SaveReader)
public void RestoreState(SaveReader r);
Reads this component state back. Every read takes the value to use when the save does not hold that name, so a value added in a game update keeps its default and an old save still loads.
| Parameter | Description |
|---|---|
r |
The place to read values from. Never null, and may be empty. |
ISaveable #
interface in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public interface ISaveable
Implemented by a component that writes and reads its own state. This is the way out for anything the built-in savers and the Field Picker cannot cover: dictionaries, polymorphic data, properties, or a value that has to be worked out rather than copied.
Shipready calls CaptureState(SaveWriter) on the main thread while a save is being gathered, and RestoreState(SaveReader) after Unity has woken the scene and before Start runs, so code in Start already sees the saved values. Set defaults in Awake or in field initialisers, never in Start.
Example
public class Chest : MonoBehaviour, ISaveable
{
[SerializeField] bool isOpen;
public void CaptureState(SaveWriter w) { w.Write("open", isOpen); }
public void RestoreState(SaveReader r) { isOpen = r.Read("open", false); }
}
Methods
CaptureState(SaveWriter)
void CaptureState(SaveWriter w);
Writes this component state. Called on the main thread, so every Unity API is available.
| Parameter | Description |
|---|---|
w |
The place to write values into. Never null. |
RestoreState(SaveReader)
void RestoreState(SaveReader r);
Reads this component state back. Every read takes the value to use when the save does not hold that name, so a value added in a game update keeps its default and an old save still loads.
| Parameter | Description |
|---|---|
r |
The place to read values from. Never null, and may be empty. |
LoadResult #
readonly struct in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public readonly struct LoadResult
What a load call did. It adds the two things only loading can report: which copy of the file the data came from, and which migration steps ran on the way in.
Constructors
LoadResult(SaveErrorCode, string, SaveReport, SaveFileCopy)
public LoadResult(SaveErrorCode code, string detail, SaveReport report, SaveFileCopy loadedFrom);
Builds a result. Games read results rather than build them; Shipready and its tests use this constructor.
| Parameter | Description |
|---|---|
code |
The code that classifies the outcome. |
detail |
Extra detail to append to the message. May be null. |
report |
The report for this call. Null becomes an empty report. |
loadedFrom |
Which copy of the file was read. |
LoadResult(SaveErrorCode, string, SaveReport, SaveFileCopy, DateTime)
public LoadResult(SaveErrorCode code, string detail, SaveReport report, SaveFileCopy loadedFrom, DateTime savedUtc);
Builds a result that also records when the loaded copy was saved. Games read results rather than build them; Shipready and its tests use this constructor.
| Parameter | Description |
|---|---|
code |
The code that classifies the outcome. |
detail |
Extra detail to append to the message. May be null. |
report |
The report for this call. Null becomes an empty report. |
loadedFrom |
Which copy of the file was read. |
savedUtc |
When the loaded copy was saved, in UTC. |
Properties
Code
public SaveErrorCode Code { get; }
The code that classifies the outcome, successful or not.
DocumentationLink
public string DocumentationLink { get; }
Where in the bundled documentation this outcome is explained.
LoadedFrom
public SaveFileCopy LoadedFrom { get; }
Which copy of the file was read.
Message
public string Message { get; }
A plain-English explanation, safe to show a developer in the Console.
RecoveredFromBackup
public bool RecoveredFromBackup { get; }
Whether the data came from a backup or a leftover temporary file rather than the main file. The menu shows a badge when this is true.
Report
public SaveReport Report { get; }
Counts, timings, bytes and warnings for this call. Never null.
SavedUtc
public DateTime SavedUtc { get; }
When the copy that was actually loaded was saved, in UTC: the backup's time when the load fell back to a backup, so a menu can say "Restored from backup (date)". Show it with ToLocalTime. DateTime.MinValue when nothing was loaded.
Success
public bool Success { get; }
Whether the game got its data back. A recovered load counts as success.
Methods
Fail(SaveErrorCode, string, SaveReport)
public static LoadResult Fail(SaveErrorCode code, string detail, SaveReport report);
A failed load.
| Parameter | Description |
|---|---|
code |
Why it failed. |
detail |
Extra detail to append to the message. May be null. |
report |
The report for this call. |
Returns: A result whose Success is false.
Ok(SaveReport)
public static LoadResult Ok(SaveReport report);
A successful load from the main file.
| Parameter | Description |
|---|---|
report |
The report for this call. |
Returns: A result whose Success is true.
Recovered(SaveReport, SaveFileCopy, string)
public static LoadResult Recovered(SaveReport report, SaveFileCopy copy, string detail);
A successful load that had to fall back to another copy.
| Parameter | Description |
|---|---|
report |
The report for this call. |
copy |
Which copy was read. |
detail |
Extra detail to append to the message. May be null. |
Returns: A result whose Success is true and RecoveredFromBackup is true.
ToString()
public override string ToString();
The result as one line: identifier, message and documentation link.
Returns: A human-readable line. Never null.
NavMeshAgentSaver #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class NavMeshAgentSaver : MonoBehaviour, ISaveable
The NavMesh Agent saver: where a NavMeshAgent is, where it was walking to, its speed and whether it was stopped. Add it beside a Saveable; no code. A guard saved on patrol carries on to the same point after a load.
The agent is moved with Warp, which a NavMeshAgent needs: moving its transform alone would be undone by the agent. That happens on the agent's first frame after the load, after the Saveable has put the transform back, so leave the Saveable's Position saver on or off as you like. An agent that is not on a NavMesh at that moment keeps its position and only takes the speed.
Add Component menu: Shipready → Savers → NavMesh Agent Saver
Properties
Agent
public NavMeshAgent Agent { get; set; }
The NavMeshAgent saved. Null uses the one on this object.
HasPendingRestore
public bool HasPendingRestore { get; }
Whether a load has handed over state that the agent has not taken yet.
Methods
CaptureState(SaveWriter)
public void CaptureState(SaveWriter w);
Writes this component state. Called on the main thread, so every Unity API is available.
| Parameter | Description |
|---|---|
w |
The place to write values into. Never null. |
RestoreState(SaveReader)
public void RestoreState(SaveReader r);
Reads this component state back. Every read takes the value to use when the save does not hold that name, so a value added in a game update keeps its default and an old save still loads.
| Parameter | Description |
|---|---|
r |
The place to read values from. Never null, and may be empty. |
PlaytimeTracker #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class PlaytimeTracker
Counts how long the player has played, so a slot card can show it.
Shipready adds to it each frame once the game is running, and a load sets it to whatever the save recorded, so playtime carries on from where the save left off rather than from when the application launched.
Properties
IsPaused
public bool IsPaused { get; set; }
Whether counting is paused. A game pauses it for cutscenes or menus if it wants playtime to mean time spent playing.
Seconds
public double Seconds { get; }
How long the player has played, in seconds.
Methods
AddSeconds(double)
public void AddSeconds(double seconds);
Adds time. Shipready calls this each frame; a game can call it too.
| Parameter | Description |
|---|---|
seconds |
How much to add. Negative values are ignored. |
Format(double)
public static string Format(double seconds);
Formats a number of seconds the way a slot card shows it. The result holds no language-specific words, so it reads the same everywhere until a game translates it.
| Parameter | Description |
|---|---|
seconds |
The number of seconds to format. |
Returns: A short description, for example 2h 15m.
Reset()
public void Reset();
Starts again from zero, which a new game does.
SetSeconds(double)
public void SetSeconds(double seconds);
Sets the total, which a load does from what the save recorded.
| Parameter | Description |
|---|---|
seconds |
The total to set. Negative values become zero. |
Tick(double)
public void Tick(double seconds);
Adds time unless counting is paused.
| Parameter | Description |
|---|---|
seconds |
How much to add. |
ToString()
public override string ToString();
The playtime as a short piece of text a slot card can show, for example 2h 15m or 45s.
Returns: A short description. Never null.
Saveable #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class Saveable : MonoBehaviour, ISerializationCallbackReceiver
Makes a GameObject part of the saved world. Add it to an object and the object's position, active state and the fields ticked in its Field Picker come back on load, matched by a permanent id. Scripts on the same object that implement ISaveable are saved with it.
The built-in savers: Position (local position, rotation, scale and parent), Active, Destroyed (an object destroyed during play stays destroyed, or disabled) and Physics (velocities and sleep state of a Rigidbody or Rigidbody2D; switched on automatically when the object has one).
Ids are automatic. An object placed in a scene gets one in the Editor, and a copy gets a new one. An object spawned from a prefab at runtime gets a runtime id and is saved with its prefab id, so a load can re-create it.
Add Component menu: Shipready → Saveable
Properties
Category
public string Category { get; set; }
The category this object is saved in. Left empty in the Inspector it is the world category from the settings, normally World; setting an empty value goes back to that.
DestroyedHandling
public DestroyedHandling DestroyedHandling { get; set; }
What a remembered destruction does when the scene comes back: destroy or disable.
Fields
public IReadOnlyList<SavedField> Fields { get; }
The fields ticked in the Field Picker, in the order they were ticked.
Id
public string Id { get; }
The permanent id this object is saved under. Scene objects carry the id they were given in the Editor; runtime objects get one when they wake up. Empty on a prefab asset and on an object that never woke up.
IsRuntimeSpawned
public bool IsRuntimeSpawned { get; }
Whether this object was made at runtime, by spawning a prefab or copying another object, rather than placed in a scene. A load re-creates runtime objects from their prefab.
PrefabId
public string PrefabId { get; }
The id of the prefab this object was made from: the prefab asset's GUID, set by the Editor. Empty for an object that is not part of a prefab.
SaveActive
public bool SaveActive { get; set; }
Whether the active state is saved. On by default.
SaveDestroyed
public bool SaveDestroyed { get; set; }
Whether destroying this object during play is remembered, so it stays destroyed after a load or when its scene comes back. On by default. Unloading a scene or quitting never counts as destroying.
SavePhysics
public bool SavePhysics { get; set; }
Whether the velocities and sleep state of a Rigidbody or Rigidbody2D are saved. Restored bodies are held still until the next physics step, so objects that touch do not push each other apart.
SavePosition
public bool SavePosition { get; set; }
Whether the local position, rotation, scale and parent are saved. On by default.
Methods
AddField(Component, string)
public bool AddField(Component component, string fieldName);
Ticks a field in the Field Picker. Only fields Unity itself saves (public or [SerializeField]), of a type Shipready supports, on a component of this GameObject, can be ticked. FieldSaver.IsSupportedField(FieldInfo, string) explains a refusal.
| Parameter | Description |
|---|---|
component |
A component on this GameObject. |
fieldName |
The name of one of its top-level fields. |
Returns: true when the field is ticked, including when it already was.
RemoveField(Component, string)
public bool RemoveField(Component component, string fieldName);
Unticks a field in the Field Picker.
| Parameter | Description |
|---|---|
component |
The component the field belongs to. |
fieldName |
The field's name. |
Returns: true when the field was ticked and is not any more.
SaveActions #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class SaveActions : MonoBehaviour
Saving and loading without code: drop this on any object, then pick one of its methods in a UI Button's On Click list (or any UnityEvent): Save To Slot, Load Slot, Quicksave, Quickload, Autosave, Continue, New Game, Delete Slot or Delete All Saves. The slot number goes in the box beside the method.
Each call runs in the background, so the game does not stop while a file is written, and then raises OnSucceeded or OnFailed, for a sound or a message. A call made while another is still running waits its turn in Shipready, as any save does. Nothing here asks the player first: put a confirmation in front of Delete in your own UI, or use the save menu, which asks.
Add Component menu: Shipready → Save Actions
Nested types: SaveActions.StringEvent
Properties
ContinueScene
public string ContinueScene { get; set; }
The scene loaded before Continue loads the newest save. Empty loads straight away.
DeleteAllIncludesSettings
public bool DeleteAllIncludesSettings { get; set; }
Whether Delete All Saves takes the global file with the player's settings too.
NewGameScene
public string NewGameScene { get; set; }
The scene New Game loads. Empty starts the new game in the scene that is open.
OnFailed
public StringEvent OnFailed { get; }
Raised when an action failed, with the reason.
OnSucceeded
public UnityEvent OnSucceeded { get; }
Raised when an action has finished well.
Running
public int Running { get; }
How many actions started here have not finished yet.
Methods
Autosave()
public void Autosave();
Writes the next autosave.
Continue()
public void Continue();
Loads the newest save of every kind, as a title screen's Continue button does. With a ContinueScene, that scene is loaded first.
DeleteAllSaves()
public void DeleteAllSaves();
Deletes every slot, autosave and the quicksave. Does not ask first.
DeleteSlot(int)
public void DeleteSlot(int slot);
Deletes a slot, counting from 1, with its backups and picture. Does not ask first.
LoadSlot(int)
public void LoadSlot(int slot);
Loads a slot, counting from 1.
NewGame()
public void NewGame();
Starts a new game: Shipready's data starts again (settings are kept, no file is touched), then NewGameScene loads when one is set.
Quickload()
public void Quickload();
Loads the quicksave.
Quicksave()
public void Quicksave();
Writes the quicksave.
SaveToSlot(int)
public void SaveToSlot(int slot);
Saves into a slot, counting from 1.
SaveActions.StringEvent #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class StringEvent : UnityEvent<string>
A UnityEvent that carries a line of text.
SaveData #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class SaveData
The plain values a game saves: gold, the current day, a volume setting, a list of unlocked levels. One line to store a value and one to read it back.
Values live in memory until a save writes them, and a load replaces them. Every value belongs to a category, which decides whether it ends up inside a slot or in the one global file that a slot load never touches.
Example
SaveKit.Data.Set("gold", gold, "Progress");
gold = SaveKit.Data.Get("gold", 0);
Properties
CategoryCount
public int CategoryCount { get; }
How many categories hold at least one value.
DefaultCategory
public string DefaultCategory { get; }
The category a value goes into when the game does not name one.
Methods
Clear()
public void Clear();
Forgets every value in every category, which is what starting a new game wants. Nothing on disk is touched.
A save only replaces the categories that hold values. A category with nothing in it keeps whatever the file being saved over already holds, which is what stops a save from wiping player settings that were never loaded. To start a slot afresh, delete it with SaveKit.Delete(int) before saving into it.
ClearCategory(string)
public void ClearCategory(string category);
Forgets every value in one category. As with Clear(), the next save then keeps what the file already holds for that category.
| Parameter | Description |
|---|---|
category |
The category to empty. Null uses the default category. |
Get<T>(string, T)
public T Get<T>(string key, T fallback);
Reads a value from the default category.
| Type parameter | Description |
|---|---|
T |
The value type. |
| Parameter | Description |
|---|---|
key |
The name it was stored under. |
fallback |
What to return when there is no such value. |
Returns: The stored value, or the fallback.
Get<T>(string, T, string)
public T Get<T>(string key, T fallback, string category);
Reads a value from a category.
| Type parameter | Description |
|---|---|
T |
The value type. |
| Parameter | Description |
|---|---|
key |
The name it was stored under. |
fallback |
What to return when there is no such value. |
category |
The category to read from. Null uses the default category. |
Returns: The stored value, or the fallback.
GetCategoryNames(List<string>)
public void GetCategoryNames(List<string> into);
The names of the categories that hold at least one value.
| Parameter | Description |
|---|---|
into |
The list to fill. It is cleared first. Null does nothing. |
Has(string)
public bool Has(string key);
Whether a value is stored in the default category.
| Parameter | Description |
|---|---|
key |
The name to look for. |
Returns: true when the value is there.
Has(string, string)
public bool Has(string key, string category);
Whether a value is stored in a category.
| Parameter | Description |
|---|---|
key |
The name to look for. |
category |
The category to look in. Null uses the default category. |
Returns: true when the value is there.
Reader(string)
public SaveReader Reader(string category);
A reader over a whole category.
| Parameter | Description |
|---|---|
category |
The category to read from. Null uses the default category. |
Returns: A reader, which may be empty. Never null.
Remove(string)
public bool Remove(string key);
Removes a value from the default category.
| Parameter | Description |
|---|---|
key |
The name to remove. |
Returns: true when a value was removed.
Remove(string, string)
public bool Remove(string key, string category);
Removes a value from a category.
| Parameter | Description |
|---|---|
key |
The name to remove. |
category |
The category to remove it from. Null uses the default category. |
Returns: true when a value was removed.
Set<T>(string, T)
public void Set<T>(string key, T value);
Stores a value in the default category.
| Type parameter | Description |
|---|---|
T |
The value type. See "What can be saved" in the Reference for the supported list. |
| Parameter | Description |
|---|---|
key |
The name to store it under. |
value |
The value to store. |
Set<T>(string, T, string)
public void Set<T>(string key, T value, string category);
Stores a value in a category.
A Dictionary<string, TValue> or Dictionary<int, TValue> with a supported value type is stored the way SaveWriter.WriteDictionary<TValue>(string, IDictionary<string, TValue>) stores it, and Get<T>(string, T, string) reads it back as a new dictionary. Any other dictionary is not stored: the Console says why (SK002), and Get returns the fallback.
| Type parameter | Description |
|---|---|
T |
The value type. See "What can be saved" in the Reference for the supported list. |
| Parameter | Description |
|---|---|
key |
The name to store it under. Null is ignored. |
value |
The value to store. |
category |
The category to store it in. Null uses the default category. |
Writer(string)
public SaveWriter Writer(string category);
A writer over a whole category, for a game that would rather write a group of values at once than one call at a time.
| Parameter | Description |
|---|---|
category |
The category to write into. Null uses the default category. |
Returns: A writer. Never null.
SavedField #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class SavedField
One field ticked in a Saveable's Field Picker: a component on the same GameObject and the name of one of its Inspector fields. The value is saved under <ComponentType>.<field> in the object's fields section.
Constructors
SavedField(Component, string)
public SavedField(Component component, string fieldName);
Creates a ticked field.
| Parameter | Description |
|---|---|
component |
A component on the same GameObject as the Saveable. |
fieldName |
The name of a top-level field Unity saves: public or [SerializeField]. |
Properties
Component
public Component Component { get; }
The component the field belongs to. Null when that component was removed.
FieldName
public string FieldName { get; }
The field's name.
SaveErrorCode #
enum in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public enum SaveErrorCode
Every outcome Shipready can report. Each value has a stable SK identifier and one entry in Documentation/Troubleshooting.md, so a message in the Console always leads to a fix. Values are grouped by hundreds and are never renumbered, because saved support reports quote them.
Values
| Name | Value | Description |
|---|---|---|
None |
0 |
The call succeeded and there is nothing to report. SK000. |
Unknown |
1 |
Something failed that Shipready could not classify. SK001. |
InvalidArgument |
2 |
A value handed to Shipready was missing, empty or out of range. SK002. |
Busy |
3 |
Another save or load is already running for this file and did not finish in time. SK003. Reserved for custom storage: Shipready itself never returns it in 1.0, because saves and loads of one file wait in a queue and run in order. A custom ISaveStorage may return it from a call it could not get access for. |
Cancelled |
4 |
The call was cancelled before it finished. SK004. Reserved for custom storage: the 1.0 API has no way to cancel a call, so Shipready itself never returns it. A custom ISaveStorage may return it from a call that was stopped. A kit stopped or restarted during a call reports NotInitialised instead. |
NotInitialised |
5 |
Shipready was used before it was initialised, usually a missing settings asset. SK005. |
FileNotFound |
100 |
No file exists for that slot or name. SK100. |
FileDamaged |
101 |
The file could not be read as a save at all, and no valid copy was found. SK101. |
RecoveredFromBackup |
102 |
The main file was unusable, so a backup was loaded instead. The load succeeded. SK102. |
UnsupportedFormat |
103 |
The file is a save, but in an envelope format Shipready version cannot read. SK103. |
ChecksumMismatch |
104 |
The checksum does not match the data, so the file was changed or truncated. SK104. |
TamperDetected |
105 |
An encrypted file failed its tamper check. SK105. |
EncryptionKeyWrong |
106 |
An encrypted file could not be decrypted with the current passphrase. SK106. |
CompressionFailed |
107 |
Compressed data could not be unpacked. SK107. |
DiskFull |
110 |
The disk has no room left. Existing saves were not touched. SK110. |
AccessDenied |
111 |
The folder or file could not be written, usually a permission or read-only problem. SK111. |
StorageUnavailable |
112 |
The storage layer could not be reached, for example a removed drive. SK112. |
PathTooLong |
113 |
The resulting file path is longer than the platform allows. SK113. |
NewerVersion |
120 |
The file was written by a newer save version than this build understands. SK120. |
MigrationMissing |
121 |
A migration step needed to upgrade this file does not exist. SK121. |
MigrationFailed |
122 |
A migration step ran but failed. SK122. |
SaveVersionInvalid |
123 |
The configured save version is not a valid whole number above zero. SK123. |
ObjectNotFound |
130 |
A saved object no longer exists in the scene, so its state was skipped. SK130. |
PrefabNotRegistered |
131 |
A saved runtime object names a prefab that is not in the Prefab Registry. SK131. |
AssetNotRegistered |
132 |
A saved reference names an asset that is not in the Asset Registry. SK132. |
SceneNotRegistered |
133 |
A saved scene is not in the Scene Registry. SK133. |
SceneNotInBuildSettings |
134 |
A scene the save needs is not in Build Settings, so it cannot be loaded. SK134. |
HostOnly |
140 |
Only the host or a solo player may do this. SK140. |
PlayerUnknown |
141 |
A connected player could not be matched to a stable player id, so they start from defaults. SK141. Reported in the Console by SaveKit.Players.ForConnection and SaveKit.Players.TryGetPlayerId when the game's IPlayerIdentity fails, and by ForConnection when no identity is set or the identity does not name the connection. A player id the save has never seen is not this code: that player simply gets empty data. |
CategoryUnknown |
150 |
A category name was used that the settings asset does not define. SK150. |
SlotOutOfRange |
151 |
The slot number is outside the configured range. SK151. |
SlotEmpty |
152 |
The slot holds no save yet. SK152. |
SettingsInvalid |
153 |
A value in the settings asset cannot be used, such as a file name pattern without {0} in it. SK153. |
LoadInProgress |
154 |
A load is still loading the scenes its save was made in, so a save now would write a half-restored world over what the load just put back. Nothing was written. Save again once the load has finished. SK154. |
SaveErrorInfo #
static class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public static class SaveErrorInfo
Turns a SaveErrorCode into the three things a developer needs: a stable SK identifier, a plain-English message and the place in the bundled documentation that explains it. Every lookup is allocation-free apart from the strings it returns, which are constants.
Constants
TroubleshootingPath
public const string TroubleshootingPath = "RareGeometry/Shipready/Save/Documentation/Troubleshooting.md";
The documentation file every error code links into, as a path inside the package.
Methods
GetAllCodes()
public static SaveErrorCode[] GetAllCodes();
Every value of SaveErrorCode, for the documentation test that checks each one has a Troubleshooting entry.
Returns: A fresh array of every declared code.
GetAnchor(SaveErrorCode)
public static string GetAnchor(SaveErrorCode code);
The anchor inside the Troubleshooting guide for a code, for example #sk101.
| Parameter | Description |
|---|---|
code |
The code to link to. |
Returns: A Markdown anchor, including the leading hash.
GetDocumentationLink(SaveErrorCode)
public static string GetDocumentationLink(SaveErrorCode code);
The documentation link reported alongside a result, as a path inside the package followed by the anchor for this code.
| Parameter | Description |
|---|---|
code |
The code to link to. |
Returns: A path and anchor, or an empty string for SaveErrorCode.None.
GetId(SaveErrorCode)
public static string GetId(SaveErrorCode code);
The SK identifier for a code, for example SK101. Support reports and the Troubleshooting guide both use this form.
| Parameter | Description |
|---|---|
code |
The code to identify. |
Returns: A three-digit identifier with an SK prefix.
GetMessage(SaveErrorCode)
public static string GetMessage(SaveErrorCode code);
A plain-English explanation of a code, written for a developer reading the Console.
| Parameter | Description |
|---|---|
code |
The code to explain. |
Returns: One sentence, never null and never empty.
IsFileDamage(SaveErrorCode)
public static bool IsFileDamage(SaveErrorCode code);
Whether a code describes a file that could not be read, which is what makes the recovery loader move on to the next copy.
| Parameter | Description |
|---|---|
code |
The code to classify. |
Returns: true when the copy should be treated as damaged.
IsSuccess(SaveErrorCode)
public static bool IsSuccess(SaveErrorCode code);
Whether a code means the call succeeded. SaveErrorCode.None and SaveErrorCode.RecoveredFromBackup are both successes, because a recovered load did give the game its data back.
| Parameter | Description |
|---|---|
code |
The code to classify. |
Returns: true when the call delivered what it was asked for.
SaveEventInfo #
struct in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public struct SaveEventInfo
What an event is telling the game about.
Properties
Success
public bool Success { get; }
Whether the operation did what it was asked to do.
Fields
Code
public SaveErrorCode Code;
The code the operation reported.
FileName
public string FileName;
The storage-relative file name.
LoadedFrom
public SaveFileCopy LoadedFrom;
Which copy of the file was read. Only meaningful for a load.
Operation
public SaveOperation Operation;
Which operation this is about.
Report
public SaveReport Report;
Counts, timings, bytes and warnings. Null for an event raised before the work starts.
Slot
public int Slot;
The slot number, or zero for the global file, an autosave or a quicksave.
Methods
ToString()
public override string ToString();
The event as one line, for logs.
Returns: A short description. Never null.
SaveEventListener #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class SaveEventListener : MonoBehaviour
Shipready's save and load events as UnityEvents, so a sound, an animation or a message can follow a save without code: drag an object into a list and pick what it does. Shown in the Add Component menu as Save Events.
The tick boxes pick which saves count: slot saves, autosaves, the quicksave and the global file (player settings), so a "Game saved" sound need not play every time a setting is stored. Listening starts when the component is enabled and stops when it is disabled.
Add Component menu: Shipready → Save Events
Properties
Autosaves
public bool Autosaves { get; set; }
Whether autosaves count. On by default.
GlobalFile
public bool GlobalFile { get; set; }
Whether the global file counts. Off by default.
OnLoaded
public UnityEvent OnLoaded { get; }
A load has finished and worked.
OnLoadFailed
public UnityEvent OnLoadFailed { get; }
A load has finished and failed.
OnLoading
public UnityEvent OnLoading { get; }
A load has started.
OnRecoveredFromBackup
public UnityEvent OnRecoveredFromBackup { get; }
A damaged save was loaded from its backup instead.
OnSaved
public UnityEvent OnSaved { get; }
A save has finished and worked.
OnSaveFailed
public UnityEvent OnSaveFailed { get; }
A save has finished and failed.
OnSaving
public UnityEvent OnSaving { get; }
A save has started.
Quicksave
public bool Quicksave { get; set; }
Whether the quicksave counts. On by default.
Slots
public bool Slots { get; set; }
Whether slot saves and loads count. On by default.
SaveEvents #
static class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public static class SaveEvents
The points a game can hook into: a save or load starting, finishing, or finishing by falling back to a backup.
A handler runs on the main thread, so it is safe to touch Unity objects, show a saving icon or pause the game from one. The one thing a handler must not do is start another save of the same file, which would queue behind the one that is finishing.
Handlers are cleared when static state resets, so turning off domain reload cannot leave a handler from a previous play session attached to a destroyed object.
Properties
Generation
public static int Generation { get; }
Changes every time the handlers are cleared, which SaveKit.Shutdown() does. A component that listens for as long as it lives compares it with the number it subscribed under, and subscribes again when it changed, so it keeps working after Shipready is stopped and started again (a profile switch, for example).
Methods
Clear()
public static void Clear();
Removes every handler. Called when static state resets.
Events
Loaded
public static event Action<SaveEventInfo> Loaded;
Raised when a load has finished, successfully or not.
Loading
public static event Action<SaveEventInfo> Loading;
Raised when a load starts, before the file is read.
RecoveredFromBackup
public static event Action<SaveEventInfo> RecoveredFromBackup;
Raised when a load had to fall back to a backup. Loaded is raised as well, so a game that only wants to know about the recovery can listen to just this.
Saved
public static event Action<SaveEventInfo> Saved;
Raised when a save has finished, successfully or not.
Saving
public static event Action<SaveEventInfo> Saving;
Raised when a save starts, before anything is gathered. A handler can still put its latest values into SaveKit.Data here and they are part of the save. Values changed after the save call returns are not, because the save works on a copy.
SaveFileKind #
enum in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public enum SaveFileKind
What a save file is to the game. See SaveKit.KindOf(string).
Values
SaveKit #
static class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public static class SaveKit
The front door. Everything a game needs for saving is reachable from here: the plain values, the slots, the global file, the autosaves and the migrations.
Nothing here throws. Every call hands back a result with a code, a plain-English message and a link into the Troubleshooting guide.
Every call that ends in Async finishes back on the main thread, so the code after an await can touch Unity objects freely. That also means the main thread must be left free to get there: never call .Wait() or read .Result on one of these tasks from the main thread, because the task is waiting for that same thread and the game would stop dead. When a save has to finish before the next line runs, which is the case when the game is quitting, use the plain Save(int, string[]) and Load(int, string[]) instead. They are built for exactly that.
A save only gathers the values on the main thread. Reading the file already there, bringing it up to date, merging, packing and writing all happen on a background thread, in the queue for that file. A load reads, checks and migrates on a background thread and only puts the values into Data back on the main thread.
Example
SaveKit.Data.Set("gold", gold, "Progress");
SaveResult saved = await SaveKit.SaveAsync(slot: 1);
if (!saved.Success) Debug.LogWarning(saved.Message);
Properties
Authority
public static ISaveAuthority Authority { get; set; }
Decides who may save and load world data. Null, the default, is a solo game: always allowed. When it says no, every slot, autosave and quicksave save, load and delete returns SaveErrorCode.HostOnly without touching storage; the global file stays available, so a co-op client keeps its own settings.
Autosaves
public static AutosaveScheduler Autosaves { get; }
Decides when an autosave is due. Null before Shipready starts. A game switches AutosaveScheduler.Enabled off during a cutscene or a boss fight.
CanLoad
public static bool CanLoad { get; }
Whether this game instance may load, delete and restore slots, autosaves and the quicksave right now. False for a co-op client, so a menu hides those buttons.
CanSave
public static bool CanSave { get; }
Whether this game instance may save slots, autosaves and the quicksave right now: Shipready has started, and there is no Authority or it says yes. False for a co-op client, so a menu hides its save buttons.
Data
public static SaveData Data { get; }
The plain values a game saves. Never null.
HasAnySave
public static bool HasAnySave { get; }
Whether there is a save to continue from: any slot, autosave or the quicksave that LoadMostRecent(string[]) could load. False before Shipready starts and on a co-op client. A Continue button greys out while this is false.
HasUnsavedProgress
public static bool HasUnsavedProgress { get; }
Whether quitting now would lose play: the playtime (Playtime) has grown by at least UnsavedProgressSeconds since the progress was last safe on disk. Playtime stops while it is paused (the save menu and the Game Menu pause it while they are open), so time on a title screen or in a pause menu does not count. False before Shipready starts. The save menu's quit confirmation asks this.
Identity
public static IPlayerIdentity Identity { get; set; }
Maps a connected player to the stable id their data is kept under. Null until a game sets one.
IsInitialised
public static bool IsInitialised { get; }
Whether Shipready has settings and somewhere to save to.
Location
public static string Location { get; set; }
Where the player is, as the game wants it described on the slot card.
Migrations
public static MigrationRunner Migrations { get; }
The migration steps that bring old saves up to date. A game can add steps here instead of marking methods with [SaveMigration]. A step added here always wins over one found by its attribute, whether it is added before or after Shipready starts. Never null.
Players
public static PlayerData Players { get; }
Per-player data in a co-op game, saved inside the host's slot under each player's stable id. Never null.
Playtime
public static PlaytimeTracker Playtime { get; }
How long the player has played. Never null.
ProfileId
public static string ProfileId { get; set; }
Whose saves to use on a shared machine, such as the player's Steam ID. Set it before Initialise(SaveKitSettings): Shipready then replaces {profile} in SaveKitSettings.ProfileFolder with it, so a profile folder of {profile} keeps each player's saves in Saves/<id>. A profile folder without {profile} is used as it is, and then this id is not needed.
Changing it while Shipready runs does nothing until Shipready starts again. With {profile} in the profile folder and no id, Initialise fails with SaveErrorCode.SettingsInvalid rather than mixing players' saves, so switch off SaveKitSettings.InitialiseAutomatically and start Shipready yourself once the id is known. The id is kept by Shutdown(), so starting again uses it, and forgotten when a new play session starts. Null is stored as empty.
Example
SaveKit.ProfileId = SteamUser.GetSteamID().ToString(); // your Steam library's call
SaveKit.Initialise();
Settings
public static SaveKitSettings Settings { get; }
The settings Shipready is using, or null before it starts.
SlotName
public static string SlotName { get; set; }
The name the next save records, such as a chapter title. The menu shows it on the slot card.
SpawnHandler
public static ISpawnHandler SpawnHandler { get; set; }
Makes and removes the runtime objects a load re-creates, for a pool, a network library or Addressables. Null uses Instantiate and Destroy.
Storage
public static ISaveStorage Storage { get; }
Where save files are kept, or null before Shipready starts.
ThumbnailCamera
public static Camera ThumbnailCamera { get; set; }
The camera the picture of an autosave or quicksave is rendered with while SaveKitSettings.CaptureAutosaveThumbnails is on. Null, the default, uses Camera.main, as does a camera that has been destroyed or switched off. Set it when the main camera is not the view the player should see on the card, for example in a game that renders through several cameras. Kept by Shutdown(), and forgotten when a new play session starts.
TimeSinceLastSave
public static TimeSpan TimeSinceLastSave { get; }
How long the game has been running since its progress was last safe on disk: the last slot save, autosave or quicksave that succeeded (counted from when its values were gathered), the last load, NewGame(), or Shipready starting, whichever came last. Real time, so it keeps counting while the game is paused. Zero before Shipready starts.
UnsavedProgressSeconds
public static double UnsavedProgressSeconds { get; set; }
How many seconds of play count as progress worth asking about before quitting. 5 by default, so a player who loads and quits at once is not asked. 0 asks after any play. Negative values are stored as 0.
World
public static SaveWorld World { get; }
The saved world: scene memory, the scene loader, and the hooks for pools. Never null, also before Shipready starts.
Constants
MaximumSlotNameLength
public const int MaximumSlotNameLength = 64;
The longest name RenameSlot(int, string) keeps. Longer names are cut.
Methods
Autosave()
public static SaveResult Autosave();
Writes the next autosave, rotating through the autosave files so that an autosave never overwrites the one before it.
Returns: What happened.
AutosaveAsync()
public static Task<SaveResult> AutosaveAsync();
Writes the next autosave on a background thread.
Returns: A task that finishes with the result. It never faults.
CopySlot(int, int)
public static SaveResult CopySlot(int fromSlot, int toSlot);
Copies one slot into another, with its picture, so the player can keep a save before a risky choice. The copy is the same save: the same data, name, playtime and save time. Whatever the target slot held is replaced, and kept as that slot's newest backup. A menu asks before overwriting; this call does not.
| Parameter | Description |
|---|---|
fromSlot |
The slot to copy, counting from 1. |
toSlot |
The slot to copy into, counting from 1. Not the same slot. |
Returns: What happened. SlotEmpty when there is nothing to copy.
CopySlot(SlotInfo, int)
public static SaveResult CopySlot(SlotInfo from, int toSlot);
Copies the save a slot info describes, a manual slot, an autosave or the quicksave, into a manual slot. This is how a player keeps an autosave that would otherwise be overwritten. See CopySlot(int, int).
| Parameter | Description |
|---|---|
from |
A slot info from GetSlotInfo(int), GetAutosaveInfos(List<SlotInfo>) or GetQuicksaveInfo(). |
toSlot |
The slot to copy into, counting from 1. |
Returns: What happened.
Delete(int)
public static SaveResult Delete(int slot);
Deletes a slot and every backup of it.
| Parameter | Description |
|---|---|
slot |
The slot number, counting from 1. |
Returns: What happened.
Delete(SlotInfo)
public static SaveResult Delete(SlotInfo info);
Deletes the save a slot info describes, whether it is a manual slot, one of the autosaves or the quicksave, with every backup and its thumbnail.
| Parameter | Description |
|---|---|
info |
A slot info from GetSlotInfo(int), GetAutosaveInfos(List<SlotInfo>) or GetQuicksaveInfo(). |
Returns: What happened. InvalidArgument when the info names no file of this game.
DeleteAllSaves(bool)
public static SaveResult DeleteAllSaves(bool includeGlobal = false);
Deletes every slot, autosave and the quicksave, each with its backups and picture: the "reset progress" button of an options screen. The global file with the player's settings is kept unless includeGlobal is true. The values in memory are not touched, so call NewGame() afterwards to start afresh. A co-op client gets SaveErrorCode.HostOnly and nothing is deleted.
| Parameter | Description |
|---|---|
includeGlobal |
Whether the global file goes too. |
Returns: What happened. When a file could not be deleted, the first failure, after the rest were still tried.
GetAutosaveInfos(List<SlotInfo>)
public static int GetAutosaveInfos(List<SlotInfo> into);
The slot info for each autosave, newest first, for a menu that offers to continue.
| Parameter | Description |
|---|---|
into |
The list to fill. It is cleared first. Null does nothing. |
Returns: How many autosaves were found.
GetMostRecentSaveInfo()
public static SlotInfo GetMostRecentSaveInfo();
The newest save of every kind, for a Continue button that shows what it will load: the slot, autosave or quicksave with the latest save time. Saves that cannot be loaded (damaged with no valid backup, or from a newer version of the game) are passed over.
Returns: The slot info, or null when there is nothing to continue.
GetQuicksaveInfo()
public static SlotInfo GetQuicksaveInfo();
The slot info for the quicksave, for a menu that lists it beside the slots. Never null: when the quicksave is switched off or nothing has been quicksaved yet, the info says SlotInfo.Exists is false.
Returns: The quicksave's slot info, with SlotInfo.IsQuicksave set.
GetSlotInfo(int)
public static SlotInfo GetSlotInfo(int slot);
What the menu needs to draw one slot card, read without unpacking the game data.
| Parameter | Description |
|---|---|
slot |
The slot number, counting from 1. |
Returns: The slot info. Never null: an empty slot, an out-of-range slot and a damaged slot all come back as an object the menu can draw.
GetSlotInfos(List<SlotInfo>)
public static int GetSlotInfos(List<SlotInfo> into);
What the menu needs to draw every slot card, in slot order. Empty slots are included, so the list always holds exactly as many entries as the game has slots.
| Parameter | Description |
|---|---|
into |
The list to fill. It is cleared first. Null does nothing. |
Returns: How many slots were filled in.
HasSave(int)
public static bool HasSave(int slot);
Whether a slot holds a save.
| Parameter | Description |
|---|---|
slot |
The slot number, counting from 1. |
Returns: true when there is something to load.
Initialise()
public static SaveResult Initialise();
Starts Shipready with the settings asset from a Resources folder, which is where the Setup Wizard puts it.
Returns: What happened.
Initialise(SaveKitSettings)
public static SaveResult Initialise(SaveKitSettings settings);
Starts Shipready with given settings and the file storage they describe.
| Parameter | Description |
|---|---|
settings |
The settings to use. |
Returns: What happened.
Initialise(SaveKitSettings, ISaveStorage)
public static SaveResult Initialise(SaveKitSettings settings, ISaveStorage storage);
Starts Shipready with given settings and a storage of the caller choosing, which is how tests run against memory rather than disk.
When a global file exists it is loaded before this returns, so the player settings are in place before anything reads them. A global file that cannot be loaded does not stop Shipready starting: the result is still a success, with a warning in its report, and the global categories start empty. The global file is then never overwritten by a slot save until it can be read again.
| Parameter | Description |
|---|---|
settings |
The settings to use. Null fails. |
storage |
Where to keep files. Null builds file storage from the settings. |
Returns: What happened.
KindOf(string)
public static SaveFileKind KindOf(string fileName);
What a save file is to this game: a manual slot, an autosave, the quicksave or the global file. A saving icon or a Save Events component uses it to tell an autosave from a save the player made, from the SaveEventInfo.FileName of an event.
| Parameter | Description |
|---|---|
fileName |
A storage-relative file name, as an event carries it. |
Returns: The kind, or SaveFileKind.Other before Shipready starts or for a file of no known kind.
Load(int, string[])
public static LoadResult Load(int slot, string[] categories = null);
Loads a slot and waits for it to finish.
| Parameter | Description |
|---|---|
slot |
The slot number, counting from 1. |
categories |
Which categories to load. Null loads every category that belongs in a slot. A category the file does not hold goes back to empty, so its values fall back to their defaults. Global categories are not touched, so a load never takes player settings back. |
Returns: What happened.
Load(SlotInfo, string[])
public static LoadResult Load(SlotInfo info, string[] categories = null);
Loads the save a slot info describes, whether it is a manual slot, one of the autosaves or the quicksave, and waits for it to finish. This is what a menu that lists GetAutosaveInfos(List<SlotInfo>) and GetQuicksaveInfo() beside the slots uses.
| Parameter | Description |
|---|---|
info |
A slot info from GetSlotInfo(int), GetAutosaveInfos(List<SlotInfo>) or GetQuicksaveInfo(). |
categories |
Which categories to load. Null loads all the slot ones. |
Returns: What happened. InvalidArgument when the info names no file of this game.
LoadAsync(int, string[])
public static Task<LoadResult> LoadAsync(int slot, string[] categories = null);
Loads a slot on a background thread. Reading, checking and bringing the file up to date happen there; the values are put into Data back on the main thread.
| Parameter | Description |
|---|---|
slot |
The slot number, counting from 1. |
categories |
Which categories to load. Null loads all the slot ones. |
Returns: A task that finishes with the result. It never faults. An empty slot finishes with SaveErrorCode.SlotEmpty. The disk is only asked on the background thread, so, unlike Load(int, string[]), which refuses an empty slot before it starts, the load of an empty slot raises SaveEvents.Loading and SaveEvents.Loaded like any other load that fails.
LoadAsync(SlotInfo, string[])
public static Task<LoadResult> LoadAsync(SlotInfo info, string[] categories = null);
Loads the save a slot info describes on a background thread: a manual slot, an autosave or the quicksave.
| Parameter | Description |
|---|---|
info |
A slot info from GetSlotInfo(int), GetAutosaveInfos(List<SlotInfo>) or GetQuicksaveInfo(). |
categories |
Which categories to load. Null loads all the slot ones. |
Returns: A task that finishes with the result. It never faults.
LoadGlobal()
public static LoadResult LoadGlobal();
Loads the global categories. Shipready already does this when it starts, so a game only calls it to take the player settings back to what was last saved.
Returns: What happened. A game with no global file yet gets FileNotFound.
LoadGlobalAsync()
public static Task<LoadResult> LoadGlobalAsync();
Loads the global categories on a background thread. Which of the global file's names to read is decided there too, so the main thread asks the disk nothing.
Returns: A task that finishes with the result. It never faults.
LoadInBackground(int, Action<LoadResult>, string[])
public static void LoadInBackground(int slot, Action<LoadResult> onComplete, string[] categories = null);
Loads a slot on a background thread, as LoadAsync(int, string[]) does, and calls onComplete with the result when it has finished, after the saved scenes are back in Load Saved Scenes mode.
The callback runs on the main thread. A load refused straight away, such as one of an empty slot, calls it before this method returns. An exception thrown by the callback is caught and written to the Console; it never reaches Shipready or the game.
| Parameter | Description |
|---|---|
slot |
The slot number, counting from 1. |
onComplete |
What to call with the result. Null loads without telling anybody. |
categories |
Which categories to load. Null loads all the slot ones. |
LoadMostRecent(string[])
public static LoadResult LoadMostRecent(string[] categories = null);
Loads the newest save of every kind, which is what a title screen's Continue button does: the slot, autosave or quicksave with the latest save time, passing over saves that cannot be loaded. Waits for it to finish.
| Parameter | Description |
|---|---|
categories |
Which categories to load. Null loads all the slot ones. |
Returns: What happened. FileNotFound when there is nothing to continue.
LoadMostRecentAsync(string[])
public static Task<LoadResult> LoadMostRecentAsync(string[] categories = null);
Loads the newest save of every kind on a background thread, as LoadAsync(int, string[]) loads a slot. Which save is newest is decided first, on the main thread, from the slot cache, as the menu's list does.
| Parameter | Description |
|---|---|
categories |
Which categories to load. Null loads all the slot ones. |
Returns: A task that finishes with the result. It never faults. FileNotFound when there is nothing to continue.
LoadNewestAutosave()
public static LoadResult LoadNewestAutosave();
Loads the newest autosave.
Returns: What happened. FileNotFound when there are no autosaves yet.
LoadNewestAutosaveAsync()
public static Task<LoadResult> LoadNewestAutosaveAsync();
Loads the newest autosave on a background thread: reading, checking and migrating happen there, and in Load Saved Scenes mode the task finishes once the saved scenes are back, as for LoadAsync(int, string[]). Which autosave is newest is found there too, so the main thread asks the disk nothing.
Returns: A task that finishes with the result. It never faults. FileNotFound when there are no autosaves yet.
LoadQuicksave()
public static LoadResult LoadQuicksave();
Loads the quicksave.
Returns: What happened.
LoadQuicksaveAsync()
public static Task<LoadResult> LoadQuicksaveAsync();
Loads the quicksave on a background thread, as LoadAsync(int, string[]) loads a slot.
Returns: A task that finishes with the result. It never faults.
LoadScene(string, LoadSceneMode)
public static AsyncOperation LoadScene(string sceneNameOrPath, LoadSceneMode mode = LoadSceneMode.Single);
Loads a scene the way Shipready can remember: before a single load replaces the loaded scenes, their state is captured into scene memory, and when the player comes back to a scene its remembered state is applied before any Start runs. Loads through SaveWorld.SceneLoader when the game set one.
| Parameter | Description |
|---|---|
sceneNameOrPath |
The scene's name, such as Town, or its path, such as Assets/Levels/Town.unity. |
mode |
Whether the scene replaces the loaded ones or is added to them. |
Returns: The load in progress, or null when the scene cannot be loaded (reported in the Console).
NewGame()
public static void NewGame();
Starts a new game in Shipready's data: every slot category becomes empty, so the next save replaces those categories in the file instead of keeping the old slot's; scene memory, destroyed lists, spawned objects and players are forgotten; the slot name, location, summary and playtime start again. Global categories, such as the player's settings, are kept. Nothing on disk is touched.
Shipready resets its data; the game resets its own scene objects. Either load the first scene of the new game straight after this (for example with LoadScene(string, LoadSceneMode)), or, to start the new game in the scene that is open, put that scene's objects back to their starting state yourself. Objects in the open scenes keep whatever state they have, and the next save captures them as they are.
The scenes open at this moment are marked, so that leaving them through LoadScene(string, LoadSceneMode) or UnloadScene(Scene) (or SaveWorld.CaptureScene(Scene) before an unload of your own) does not capture the old game back into scene memory. A save the player or your code asks for (Save(int, string[]), SaveAsync(int, string[]), SaveInBackground(int, Action<SaveResult>, string[]), a quicksave, or your own call to Autosave() or AutosaveAsync()) captures every loaded scene and clears the mark of each scene it captures, because from then on its state belongs to the new game. Shipready's own automatic saves (the timer, a scene change, quitting or being suspended) leave a marked scene out and keep its mark, so they can never write the old game's objects into the new game's save. Scenes loaded from now on are captured as usual.
PreviewSave(string[])
public static SaveTree PreviewSave(string[] categories = null);
What a save would write right now, without writing anything and without changing Data: the world is captured into a copy of the categories, as a save would capture it, and that copy comes back as a tree with the players and the slot info. The Save Inspector's live view shows this.
| Parameter | Description |
|---|---|
categories |
Which categories to include. Null includes every category. |
Returns: The tree, or null when Shipready has not started or a category is unknown.
Quicksave()
public static SaveResult Quicksave();
Writes the quicksave, when the settings have it switched on.
Returns: What happened.
QuicksaveAsync()
public static Task<SaveResult> QuicksaveAsync();
Writes the quicksave on a background thread, when the settings have it switched on. The values are gathered before this returns, as for SaveAsync(int, string[]).
Returns: A task that finishes with the result. It never faults.
RenameSlot(int, string)
public static SaveResult RenameSlot(int slot, string name);
Gives a saved slot a new name, the one its card shows, without touching anything else in it. The save time stays as it was. Empty or blank goes back to the slot's own name, such as Slot 2. A name longer than MaximumSlotNameLength is cut. When the game is playing the save it renames, the next save keeps the new name.
| Parameter | Description |
|---|---|
slot |
The slot number, counting from 1. |
name |
The new name. |
Returns: What happened. SlotEmpty when the slot holds nothing.
RenameSlot(SlotInfo, string)
public static SaveResult RenameSlot(SlotInfo info, string name);
Renames the save a slot info describes: a manual slot, an autosave or the quicksave. See RenameSlot(int, string).
| Parameter | Description |
|---|---|
info |
A slot info from GetSlotInfo(int), GetAutosaveInfos(List<SlotInfo>) or GetQuicksaveInfo(). |
name |
The new name. |
Returns: What happened.
RestoreBackup(int)
public static SaveResult RestoreBackup(int slot);
Puts the newest valid backup of a damaged slot back in place, and waits for it to finish. The menu offers this as Restore backup when automatic fallback is switched off (SaveFileOptions.AutomaticFallback).
The backup is copied unchanged over the main file through the crash-safe write, so the slot then loads normally and carries the backup's save time. The damaged main file is kept aside as .corrupt-<time>; the backups stay where they are. A main file that reads correctly is never replaced. Like Delete(int), a co-op client gets SaveErrorCode.HostOnly.
| Parameter | Description |
|---|---|
slot |
The slot number, counting from 1. |
Returns: SaveErrorCode.RecoveredFromBackup on success, which counts as a success; SaveErrorCode.FileDamaged when no backup is valid, with nothing changed.
RestoreBackup(SlotInfo)
public static SaveResult RestoreBackup(SlotInfo info);
Puts the newest valid backup of the save a slot info describes back in place: a manual slot, an autosave or the quicksave. See RestoreBackup(int).
| Parameter | Description |
|---|---|
info |
A slot info from GetSlotInfo(int), GetAutosaveInfos(List<SlotInfo>) or GetQuicksaveInfo(). |
Returns: What happened.
RestoreBackupAsync(int)
public static Task<SaveResult> RestoreBackupAsync(int slot);
Puts the newest valid backup of a damaged slot back in place on a background thread. See RestoreBackup(int).
| Parameter | Description |
|---|---|
slot |
The slot number, counting from 1. |
Returns: A task that finishes with the result. It never faults.
RestoreBackupAsync(SlotInfo)
public static Task<SaveResult> RestoreBackupAsync(SlotInfo info);
The background version of RestoreBackup(SlotInfo).
| Parameter | Description |
|---|---|
info |
A slot info from GetSlotInfo(int), GetAutosaveInfos(List<SlotInfo>) or GetQuicksaveInfo(). |
Returns: A task that finishes with the result. It never faults.
Save(int, string[])
public static SaveResult Save(int slot, string[] categories = null);
Saves a slot and waits for it to finish. Use this when the game is quitting or being suspended, because the operating system will not wait for a background thread.
| Parameter | Description |
|---|---|
slot |
The slot number, counting from 1. |
categories |
Which categories to save. Null saves all of them. Naming a few is how a checkpoint writes only Progress and World and leaves the rest of the file as it was. A category that holds no values in Data also keeps what the file holds. |
Returns: What happened. A save that has to keep categories from the file already there fails, and leaves the file untouched, when that file cannot be read, is from a newer version of the game, or cannot be brought up to date.
SaveAsync(int, string[])
public static Task<SaveResult> SaveAsync(int slot, string[] categories = null);
Saves a slot on a background thread. The values are gathered before this returns, so the game can change them straight away.
| Parameter | Description |
|---|---|
slot |
The slot number, counting from 1. |
categories |
Which categories to save. Null saves all of them. |
Returns: A task that finishes with the result. It never faults.
SaveGlobal()
public static SaveResult SaveGlobal();
Saves the global categories, which is where player settings live.
Returns: What happened.
SaveGlobalAsync()
public static Task<SaveResult> SaveGlobalAsync();
Saves the global categories on a background thread.
Returns: A task that finishes with the result. It never faults.
SaveInBackground(int, Action<SaveResult>, string[])
public static void SaveInBackground(int slot, Action<SaveResult> onComplete, string[] categories = null);
Saves a slot on a background thread, as SaveAsync(int, string[]) does, and calls onComplete with the result when it has finished, for code that would rather not use await.
The callback runs on the main thread, so it can touch Unity objects. A save refused straight away, such as one to a slot out of range, calls it before this method returns. An exception thrown by the callback is caught and written to the Console; it never reaches Shipready or the game.
| Parameter | Description |
|---|---|
slot |
The slot number, counting from 1. |
onComplete |
What to call with the result. Null saves without telling anybody. |
categories |
Which categories to save. Null saves all of them. |
Example
SaveKit.SaveInBackground(1, result =>
{
if (!result.Success) Debug.LogWarning(result.Message);
});
SetNextThumbnail(Texture2D)
public static void SetNextThumbnail(Texture2D texture);
Sets the picture the next slot save, autosave or quicksave stores beside its file, for the menu to show on the slot card. The picture is scaled down and copied straight away, so the game can destroy its texture as soon as this returns.
The picture is written after the save itself is safely in place, and is used once: the next successful save takes it and clears it. A picture that cannot be used, or cannot be written, is reported as a warning in that save's report and never fails the save. Call this on the main thread.
A successful slot save, autosave or quicksave made without a picture removes the thumbnail of the save it replaced, so a slot card never shows a picture of an older save. Slot saves, autosaves and quicksaves take their own picture while SaveKitSettings.CaptureAutosaveThumbnails is on, unless one was set here.
| Parameter | Description |
|---|---|
texture |
The picture, usually from ScreenCapture.CaptureScreenshotAsTexture. It has to be readable. Null clears a picture set earlier. |
SetSummary(string[])
public static void SetSummary(params string[] lines);
Sets the short lines the slot card shows under the location, such as Day 12 and $4,300. Up to four are kept.
| Parameter | Description |
|---|---|
lines |
The lines to show. Null or empty clears them. |
Shutdown()
public static void Shutdown();
Stops Shipready and forgets its settings, storage, migrations, live values, event handlers, scene memory, players and co-op hooks (Authority, Identity, SpawnHandler and the scene loader). Nothing on disk is touched apart from the slot cache, which is written if it changed. A save or load still running finishes with SaveErrorCode.NotInitialised and changes nothing in memory.
UnloadScene(Scene)
public static AsyncOperation UnloadScene(Scene scene);
Captures a scene into scene memory, then unloads it, so its state comes back when the player returns.
| Parameter | Description |
|---|---|
scene |
A loaded scene. |
Returns: The unload in progress, or null when the scene cannot be unloaded (reported in the Console).
SaveKitAutoStart #
static class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public static class SaveKitAutoStart
Starts Shipready by itself when the game runs, just before the first scene loads, so a game set up with the Setup Wizard can save and load without a line of code. It uses the settings asset in a Resources folder and only acts when that asset has SaveKitSettings.InitialiseAutomatically on and Shipready has not been started yet. A failure is written to the Console; it never throws. Code that calls SaveKit.Initialise() itself keeps working: starting again is allowed.
Methods
ShouldStart(SaveKitSettings)
public static bool ShouldStart(SaveKitSettings settings);
Whether Shipready should start by itself with these settings right now.
| Parameter | Description |
|---|---|
settings |
The settings asset, or null when the project has none. |
Returns: true when there are settings, they ask for it, and Shipready is not running yet.
StartIfWanted(SaveKitSettings)
public static bool StartIfWanted(SaveKitSettings settings);
Starts Shipready with these settings when ShouldStart(SaveKitSettings) says so. This is what happens before the first scene loads; it can also be called by hand. Never throws.
| Parameter | Description |
|---|---|
settings |
The settings to start with. Null does nothing. |
Returns: true when this call started Shipready.
SaveKitEnvironment #
static class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public static class SaveKitEnvironment
The handful of Unity values Shipready needs while it is working on a background thread.
Unity only allows most of its API on the main thread, and the whole point of saving in the background is that the packing and the disk work happen off it. So the values are read once, on the main thread, and the background work reads the copies.
They are captured again whenever static state resets, so turning off domain reload cannot leave the previous play session values behind.
Properties
ApplicationVersion
public static string ApplicationVersion { get; }
The game version string, as set in Player Settings.
CompanyName
public static string CompanyName { get; }
The company name, as set in Player Settings.
IsDebugBuild
public static bool IsDebugBuild { get; }
Whether this is a development build.
IsEditor
public static bool IsEditor { get; }
Whether the game is running inside the Unity Editor.
PersistentDataPath
public static string PersistentDataPath { get; }
Where Unity keeps per-user data on this platform.
ProductName
public static string ProductName { get; }
The game product name, as set in Player Settings.
Methods
EnsureCaptured()
public static void EnsureCaptured();
Reads the values from Unity, if they have not been read yet. Safe to call from any thread: a call from a background thread before the main thread got there leaves the defaults in place rather than throwing.
OverrideForTesting(string, bool, bool)
public static void OverrideForTesting(string productName, bool isEditor, bool isDebugBuild);
Sets the values directly, so an EditMode test can pretend to be a release build.
| Parameter | Description |
|---|---|
productName |
The product name to report. |
isEditor |
Whether to report running in the Editor. |
isDebugBuild |
Whether to report a development build. |
Recapture()
public static void Recapture();
Reads the values again. Called when static state resets and by the Setup Wizard after it changes Player Settings.
SaveKitRunner #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class SaveKitRunner : MonoBehaviour
The one hidden object Shipready keeps in a running game. It counts playtime, watches the autosave timer, makes sure a save still happens when the game is closing, applies scene memory as scenes load, and lets go of restored rigidbodies on the next physics step.
It is created whenever Shipready starts in a running game, whichever autosave triggers are switched on, because playtime and scene memory are handled here too. It is marked so that it survives a scene change and does not appear in the Hierarchy. A game never needs to add it to a scene. Starting Shipready again hands the same runner the new settings.
Properties
Instance
public static SaveKitRunner Instance { get; }
The runner in this game, or null when Shipready is not running.
Scheduler
public AutosaveScheduler Scheduler { get; }
Decides when an autosave is due.
SaveKitVersion #
static class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public static class SaveKitVersion
Version numbers Shipready stamps into every save file and reports in the Editor.
Constants
Format
public const int Format = 1;
The save envelope format number, written as the aiosk field of every file. It changes only when the envelope itself changes, never when a game's data changes.
Kit
public const string Kit = "1.0.0";
Shipready's own release version, as shown on the Asset Store. It is the same in Shipready's package.json and the newest entry of its CHANGELOG.md, which a test checks.
ProductName
public const string ProductName = "Shipready";
The product name used in logs, menus and documentation.
SaveMigrationAttribute #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class SaveMigrationAttribute : Attribute
Marks a static method as the step that upgrades a save from one version to the next.
The method takes a SaveTree and nothing else. That is deliberate: a migration edits the saved data rather than the game classes, so a step written today still works after those classes have been renamed, split or deleted.
Migrations run on a background thread, together with the rest of the file work, so a step must only edit the tree and must not touch Unity objects.
[SaveMigration(fromVersion: 3)]
static void RenameCash(SaveTree save) => save.RenameKeyEverywhere("cash", "money");
Constructors
SaveMigrationAttribute(int)
public SaveMigrationAttribute(int fromVersion);
Marks the method as the step from one save version to the next.
| Parameter | Description |
|---|---|
fromVersion |
The version this step upgrades from. A step marked 3 turns a version 3 save into a version 4 save. |
Properties
Description
public string Description { get; set; }
A name for the step, used in reports and in the Console. Defaults to the method name.
FromVersion
public int FromVersion { get; }
The version this step upgrades from.
SavePoint #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class SavePoint : MonoBehaviour
A checkpoint: saves when the player walks into its trigger, or when a UnityEvent calls SaveNow(), with a cooldown so walking back and forth does not save every step, and an "only once" option. Put it on an object with a trigger collider (3D or 2D) and tag the player Player; no code.
It writes the next autosave by default, or a chosen slot or the quicksave. The location name, when set, is what the slot card shows ("Old Mill"). The save runs in the background. Whether it has fired is not saved: give the object a Saveable with its Enabled saver, or switch it off from On Saved, to keep an only-once point used after a load.
Add Component menu: Shipready → Save Point
Properties
CanSaveNow
public bool CanSaveNow { get; }
Whether a call to SaveNow() would save right now: not used up, not cooling down, not already saving, and Shipready may save.
CooldownSeconds
public float CooldownSeconds { get; set; }
Seconds before this point saves again. 10 by default.
HasBeenUsed
public bool HasBeenUsed { get; }
Whether an only-once point has saved.
LocationName
public string LocationName { get; set; }
The location the save records. Empty leaves SaveKit.Location alone.
OnFailed
public UnityEvent OnFailed { get; }
Raised when this point could not save.
OnlyOnce
public bool OnlyOnce { get; set; }
Whether it saves only once.
OnSaved
public UnityEvent OnSaved { get; }
Raised when this point has saved.
PlayerTag
public string PlayerTag { get; set; }
The tag that sets it off. Empty: anything.
SaveOnEnter
public bool SaveOnEnter { get; set; }
Whether entering the trigger saves. On by default.
Slot
public int Slot { get; set; }
The slot saved into when Target is SavePointTarget.Slot.
Target
public SavePointTarget Target { get; set; }
What this point writes.
Methods
SaveNow()
public bool SaveNow();
Saves now, when CanSaveNow allows it. Call it from any UnityEvent, such as the end of a cutscene or a dialogue choice.
Returns: Whether a save was started.
SavePointTarget #
enum in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public enum SavePointTarget
What a SavePoint writes.
Values
| Name | Value | Description |
|---|---|---|
Autosave |
0 |
The next autosave, the usual checkpoint. |
Slot |
1 |
A numbered slot. |
Quicksave |
2 |
The quicksave. |
SaveReader #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class SaveReader
What a game reads its state out of. Every read takes the value to use when the save does not hold that name, which is what makes loading tolerant: a value added in a game update simply keeps its default, and an old save still loads.
Properties
Count
public int Count { get; }
How many values this group holds.
IsEmpty
public bool IsEmpty { get; }
Whether this reader has anything in it at all.
Node
public SaveNode Node { get; }
The tree node this reader reads from.
Methods
For(SaveNode)
public static SaveReader For(SaveNode node);
A reader over an object node, which is how Shipready hands a component the part of the save that belongs to it.
| Parameter | Description |
|---|---|
node |
The node to read. Null or a non-object node gives an empty reader. |
Returns: A reader over that node.
GetName(int)
public string GetName(int index);
The name of a value by position, for the Save Inspector and Diagnostics.
| Parameter | Description |
|---|---|
index |
The position, from zero. |
Returns: The value name, or an empty string.
Has(string)
public bool Has(string name);
Whether the save holds a value with that name.
| Parameter | Description |
|---|---|
name |
The value name. Compared exactly, including case. |
Returns: true when the name is present.
Read(string, bool)
public bool Read(string name, bool fallback);
Reads a true or false value.
| Parameter | Description |
|---|---|
name |
The value name. |
fallback |
What to use when the save does not hold this name. |
Returns: The stored value, or the fallback.
Read(string, Color)
public Color Read(string name, Color fallback);
Reads a colour.
| Parameter | Description |
|---|---|
name |
The value name. |
fallback |
What to use when the save does not hold this name. |
Returns: The stored value, or the fallback.
Read(string, double)
public double Read(string name, double fallback);
Reads a double-precision number, bit-exact.
| Parameter | Description |
|---|---|
name |
The value name. |
fallback |
What to use when the save does not hold this name. |
Returns: The stored value, or the fallback.
Read(string, float)
public float Read(string name, float fallback);
Reads a 32-bit floating-point number, bit-exact.
| Parameter | Description |
|---|---|
name |
The value name. |
fallback |
What to use when the save does not hold this name. |
Returns: The stored value, or the fallback.
Read(string, int)
public int Read(string name, int fallback);
Reads a whole number.
| Parameter | Description |
|---|---|
name |
The value name. |
fallback |
What to use when the save does not hold this name. |
Returns: The stored value, or the fallback.
Read(string, long)
public long Read(string name, long fallback);
Reads a long whole number, with every digit intact.
| Parameter | Description |
|---|---|
name |
The value name. |
fallback |
What to use when the save does not hold this name. |
Returns: The stored value, or the fallback.
Read(string, Quaternion)
public Quaternion Read(string name, Quaternion fallback);
Reads a rotation.
| Parameter | Description |
|---|---|
name |
The value name. |
fallback |
What to use when the save does not hold this name. |
Returns: The stored value, or the fallback.
Read(string, string)
public string Read(string name, string fallback);
Reads text.
| Parameter | Description |
|---|---|
name |
The value name. |
fallback |
What to use when the save does not hold this name. |
Returns: The stored value, or the fallback.
Read(string, Vector3)
public Vector3 Read(string name, Vector3 fallback);
Reads a position or any other 3D vector.
| Parameter | Description |
|---|---|
name |
The value name. |
fallback |
What to use when the save does not hold this name. |
Returns: The stored value, or the fallback.
Read<T>(string, T)
public T Read<T>(string name, T fallback);
Reads any supported value: the rest of the numbers, dates, durations, GUIDs, byte arrays, the remaining Unity types, enums, and any class or struct Unity can serialise.
| Type parameter | Description |
|---|---|
T |
The value type. |
| Parameter | Description |
|---|---|
name |
The value name. |
fallback |
What to use when the save does not hold this name. |
Returns: The stored value, or the fallback.
ReadArray<T>(string)
public T[] ReadArray<T>(string name);
Reads an array of any supported value type.
| Type parameter | Description |
|---|---|
T |
The item type. |
| Parameter | Description |
|---|---|
name |
The value name. |
Returns: A new array, or null when the save does not hold this name.
ReadAsset<T>(string, T)
public T ReadAsset<T>(string name, T fallback) where T : UnityEngine.Object;
Reads a reference to one asset back, through the Asset Registry.
| Type parameter | Description |
|---|---|
T |
The asset type. |
| Parameter | Description |
|---|---|
name |
The value name. |
fallback |
What to return when the asset cannot be found. |
Returns: The asset, or the fallback. An identifier missing from the registry is reported in the Console, not in the load report.
ReadAssets<T>(string)
public List<T> ReadAssets<T>(string name) where T : UnityEngine.Object;
Reads references to assets back, through the Asset Registry.
| Type parameter | Description |
|---|---|
T |
The asset type. |
| Parameter | Description |
|---|---|
name |
The value name. |
Returns: A new list, or null when the save does not hold this name. An identifier that is no longer in the registry, because the asset was deleted in a game update, comes back as a null entry rather than failing the load. That problem is reported in the Console with the code AssetNotRegistered, not in the load report.
ReadDictionary<TValue>(string)
public Dictionary<string, TValue> ReadDictionary<TValue>(string name);
Reads a dictionary whose keys are text.
| Type parameter | Description |
|---|---|
TValue |
The value type. |
| Parameter | Description |
|---|---|
name |
The value name. |
Returns: A new dictionary, or null when the save does not hold this name.
ReadEnum<TEnum>(string, TEnum)
public TEnum ReadEnum<TEnum>(string name, TEnum fallback) where TEnum : struct;
Reads an enum stored by name. A value that no longer exists, because it was removed in a game update, falls back instead of failing the load.
| Type parameter | Description |
|---|---|
TEnum |
The enum type. |
| Parameter | Description |
|---|---|
name |
The value name. |
fallback |
What to use when the save does not hold this name. |
Returns: The stored value, or the fallback.
ReadIntDictionary<TValue>(string)
public Dictionary<int, TValue> ReadIntDictionary<TValue>(string name);
Reads a dictionary whose keys are whole numbers. Keys that are not numbers are skipped rather than failing the load.
| Type parameter | Description |
|---|---|
TValue |
The value type. |
| Parameter | Description |
|---|---|
name |
The value name. |
Returns: A new dictionary, or null when the save does not hold this name.
ReadList<T>(string)
public List<T> ReadList<T>(string name);
Reads a list of any supported value type.
| Type parameter | Description |
|---|---|
T |
The item type. |
| Parameter | Description |
|---|---|
name |
The value name. |
Returns: A new list, or null when the save does not hold this name. An empty list in the save comes back as an empty list, not as null.
ReadList<T>(string, List<T>)
public int ReadList<T>(string name, List<T> into);
Reads a list into one the game already owns, which avoids an allocation per load. The list is cleared first.
| Type parameter | Description |
|---|---|
T |
The item type. |
| Parameter | Description |
|---|---|
name |
The value name. |
into |
The list to fill. Null does nothing. |
Returns: How many items were read. Zero when the save does not hold this name.
ReadNode(string)
public SaveNode ReadNode(string name);
The raw tree node for a value. Used by the savers and the Save Inspector, which work in nodes rather than typed values.
| Parameter | Description |
|---|---|
name |
The value name. |
Returns: The node, or null when the save does not hold this name.
ReadObject(string)
public SaveReader ReadObject(string name);
Reads a nested group of values. An absent group gives an empty reader rather than null, so a component can read from it without a null check.
| Parameter | Description |
|---|---|
name |
The group name. |
Returns: A reader over the nested group, which may be empty.
ReadObjectLink<T>(string, Action<T>)
public void ReadObjectLink<T>(string name, Action<T> assign) where T : UnityEngine.Object;
Reads back a link written with SaveWriter.WriteObjectLink(string, UnityEngine.Object), or by the Field Picker, and hands the object to assign.
Inside ISaveable.RestoreState(SaveReader), the link is settled in the second pass of the restore, once every saved object exists, including runtime objects the same load re-creates later; assign is called then, still before any Start runs. While a load is still loading its saved scenes, a link into a scene that has not loaded yet waits until every saved scene is in. Anywhere else, such as a reader from SaveKit.Data, the link is settled at once among the live objects (SaveWorld.Find(string)) and assign is called before this returns.
A link to an object that no longer exists, or that has no T, gives null and an SaveErrorCode.ObjectNotFound warning naming the value; an asset no longer registered gives null and SaveErrorCode.AssetNotRegistered. When the save does not hold name at all, assign is not called, so the field keeps its default. An exception thrown by assign becomes a warning.
| Type parameter | Description |
|---|---|
T |
What the link is wanted as: GameObject, a component type, or an asset type. |
| Parameter | Description |
|---|---|
name |
The value name. |
assign |
What to do with the object, usually setting a field. Null does nothing. |
Example
public void RestoreState(SaveReader r)
{
r.ReadObjectLink<Door>("door", d => door = d);
}
ReadObjectLinks<T>(string, Action<List<T>>)
public void ReadObjectLinks<T>(string name, Action<List<T>> assign) where T : UnityEngine.Object;
Reads back a list of links written with SaveWriter.WriteObjectLinks<T>(string, IList<T>) or by the Field Picker, and hands the list to assign, at the same moment and under the same rules as ReadObjectLink<T>(string, Action<T>). An entry whose object is gone is null in the list, with a warning, so the list keeps its length.
| Type parameter | Description |
|---|---|
T |
What the entries are wanted as: GameObject, a component type, or an asset type. |
| Parameter | Description |
|---|---|
name |
The value name. |
assign |
What to do with the new list. Null does nothing. |
SaveResult #
readonly struct in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public readonly struct SaveResult
What a save, delete or verify call did. Shipready never throws out of its public API, so every one of those calls hands back one of these instead.
Constructors
SaveResult(SaveErrorCode, string, SaveReport)
public SaveResult(SaveErrorCode code, string detail, SaveReport report);
Builds a result. Games read results rather than build them; Shipready and its tests use this constructor.
| Parameter | Description |
|---|---|
code |
The code that classifies the outcome. |
detail |
Extra detail to append to the message. May be null. |
report |
The report for this call. Null becomes an empty report. |
Properties
Code
public SaveErrorCode Code { get; }
The code that classifies the outcome, successful or not.
DocumentationLink
public string DocumentationLink { get; }
Where in the bundled documentation this outcome is explained.
Message
public string Message { get; }
A plain-English explanation, safe to show a developer in the Console.
Report
public SaveReport Report { get; }
Counts, timings, bytes and warnings for this call. Never null.
Success
public bool Success { get; }
Whether the call did what it was asked to do.
Methods
Fail(SaveErrorCode, string, SaveReport)
public static SaveResult Fail(SaveErrorCode code, string detail, SaveReport report);
A failed result.
| Parameter | Description |
|---|---|
code |
Why it failed. |
detail |
Extra detail to append to the message. May be null. |
report |
The report for this call. |
Returns: A result whose Success is false.
Ok(SaveReport)
public static SaveResult Ok(SaveReport report);
A successful result.
| Parameter | Description |
|---|---|
report |
The report for this call. |
Returns: A result whose Success is true.
ToString()
public override string ToString();
The result as one line: identifier, message and documentation link.
Returns: A human-readable line. Never null.
SaveTree #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class SaveTree
One whole save, in memory: its header, the slot info the menu shows, and the game data split into categories. Every tool in Shipready works on this one structure, which is why the menu, the Save Inspector, Diagnostics and recovery all fit into a compact asset.
A migration is handed the tree rather than the game classes, so a migration written today still works after those classes change.
Constructors
SaveTree(SaveHeader, SaveNode, SaveNode)
public SaveTree(SaveHeader header, SaveNode info, SaveNode data);
Builds a tree around existing parts, which is what the envelope reader does.
| Parameter | Description |
|---|---|
header |
The header. Null becomes a new header at save version 1. |
info |
The slot info node. Null or a non-object node becomes an empty object. |
data |
The data node. Null or a non-object node becomes an empty object. |
Properties
CategoryCount
public int CategoryCount { get; }
How many categories this save holds.
Data
public SaveNode Data { get; }
The game data, one member per category.
Header
public SaveHeader Header { get; }
The file bookkeeping: versions, time, packing and checksum.
Info
public SaveNode Info { get; }
The slot info the menu reads: name, playtime, location, thumbnail reference and the summary lines the game supplies.
Methods
AddDefaultBeside(string, string, SaveNode)
public int AddDefaultBeside(string besideName, string name, SaveNode value);
Adds a value wherever a sibling value exists but this one does not, which is how a migration gives a new field a starting value in old saves.
| Parameter | Description |
|---|---|
besideName |
The value that marks the places to look at. |
name |
The value to add. |
value |
What to set it to. Null adds nothing. |
Returns: How many values were added.
Clone()
public SaveTree Clone();
A deep copy of the whole save, which migrations use as a safety net.
Returns: A new tree that shares nothing with this one.
CreateNew(int, string)
public static SaveTree CreateNew(int saveVersion, string gameVersion);
An empty save at a given version.
| Parameter | Description |
|---|---|
saveVersion |
The game save version to stamp into the header. |
gameVersion |
The game version string to record. Null becomes empty. |
Returns: A new, empty tree.
FindPath(string)
public SaveNode FindPath(string path);
Finds a node by a slash-separated path through the data, for example World/scenes. The Save Inspector and migrations both use it.
| Parameter | Description |
|---|---|
path |
The path to follow. Null or empty returns the data node itself. |
Returns: The node at that path, or null when the path does not exist.
GetCategory(string)
public SaveNode GetCategory(string category);
The node for a category.
| Parameter | Description |
|---|---|
category |
The category name. |
Returns: The category node, or null when the save does not hold it.
GetCategoryName(int)
public string GetCategoryName(int index);
The name of a category by position.
| Parameter | Description |
|---|---|
index |
The position, from zero. |
Returns: The category name, or an empty string.
GetCategoryNames(List<string>)
public void GetCategoryNames(List<string> into);
Every category name in the save, for the Save Inspector and for partial saves.
| Parameter | Description |
|---|---|
into |
The list to fill. It is cleared first. Null does nothing. |
GetOrAddCategory(string)
public SaveNode GetOrAddCategory(string category);
The node for a category, adding an empty one when it is missing.
| Parameter | Description |
|---|---|
category |
The category name. |
Returns: The category node.
HasCategory(string)
public bool HasCategory(string category);
Whether the save holds a category.
| Parameter | Description |
|---|---|
category |
The category name. Compared exactly, including case. |
Returns: true when the category is present.
InfoReader()
public SaveReader InfoReader();
A reader over the slot info.
Returns: A reader over the info node.
InfoWriter()
public SaveWriter InfoWriter();
A writer over the slot info.
Returns: A writer over the info node.
ReaderFor(string)
public SaveReader ReaderFor(string category);
A reader over a category. A missing category gives an empty reader.
| Parameter | Description |
|---|---|
category |
The category name. |
Returns: A reader over that category.
RemoveCategory(string)
public bool RemoveCategory(string category);
Removes a category and everything in it.
| Parameter | Description |
|---|---|
category |
The category name. |
Returns: true when a category was removed.
RemoveKeyEverywhere(string)
public int RemoveKeyEverywhere(string name);
Removes a value wherever it appears in the data, for a field a game update dropped.
| Parameter | Description |
|---|---|
name |
The value name to remove. |
Returns: How many values were removed.
RenameCategory(string, string)
public bool RenameCategory(string from, string to);
Renames a category, keeping everything in it. Used when a game update reorganises which category a set of values belongs to.
| Parameter | Description |
|---|---|
from |
The current category name. |
to |
The new category name. |
Returns: true when a category was renamed.
RenameKeyEverywhere(string, string)
public int RenameKeyEverywhere(string from, string to);
Renames a value wherever it appears in the data, however deeply nested. This is the single most common migration: a field was called one thing and is now called another.
| Parameter | Description |
|---|---|
from |
The current name. |
to |
The new name. |
Returns: How many values were renamed.
VisitAll(Action<string, SaveNode>)
public void VisitAll(Action<string, SaveNode> visit);
Walks every node in the data, deepest last, calling a function for each. Migrations use it for changes that the named helpers do not cover.
| Parameter | Description |
|---|---|
visit |
What to run for each node. It receives the member name, which is empty for array items and for the data node itself, and the node. |
WriterFor(string)
public SaveWriter WriterFor(string category);
A writer over a category, adding the category when it is missing.
| Parameter | Description |
|---|---|
category |
The category name. |
Returns: A writer over that category.
SaveWorld #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class SaveWorld
The saved world: scene memory, the scene loader, and the hooks a pool or a custom scene loader needs. Reach it through SaveKit.World.
Scene memory keeps the state of scenes the player has left. A scene that loads during play gets its remembered state back automatically, before any Start runs. Leaving a scene through SaveKit.LoadScene(string, LoadSceneMode) or SaveKit.UnloadScene(Scene) captures it on the way out; a game with its own scene loading calls CaptureScene(Scene) first.
Example
SaveKit.World.CaptureScene(scene); // before unloading a scene yourself
SceneManager.UnloadSceneAsync(scene);
pool.Release(enemy);
SaveKit.World.Despawned(enemy); // a pooled object is not saved while it waits
Properties
LoadMode
public WorldLoadMode LoadMode { get; set; }
How a load treats scenes. Starting Shipready copies the settings' value here; a game may change it afterwards.
SceneLoader
public ISceneLoader SceneLoader { get; set; }
The scene loader Shipready uses for SaveKit.LoadScene(string, LoadSceneMode) and for loading saved scenes. Null loads scenes that are in Build Settings with SceneManager.LoadSceneAsync.
SceneLoadTimeoutSeconds
public float SceneLoadTimeoutSeconds { get; set; }
How many seconds a load waits for one saved scene to load before it gives up on it, warns, and finishes with the scenes it has. Zero or less uses DefaultSceneLoadTimeoutSeconds. A scene that loads later still gets its saved state.
Constants
DefaultSceneLoadTimeoutSeconds
public const float DefaultSceneLoadTimeoutSeconds = 120f;
How long a load waits for one saved scene before it carries on without it, unless set otherwise.
Methods
ApplyScene(Scene)
public void ApplyScene(Scene scene);
Applies the remembered state of a loaded scene now, replacing its runtime objects with the remembered ones. A scene that loads during play gets this automatically.
| Parameter | Description |
|---|---|
scene |
A loaded scene. |
CaptureScene(Scene)
public void CaptureScene(Scene scene);
Remembers the state of a loaded scene now. Call it before unloading a scene yourself; SaveKit.LoadScene(string, LoadSceneMode) and SaveKit.UnloadScene(Scene) already do.
| Parameter | Description |
|---|---|
scene |
A loaded scene. |
ClearAll()
public void ClearAll();
Drops every scene's remembered state, every destroyed list and every spawned object from the live data, which is what a new game wants. Nothing on disk is touched.
Despawned(GameObject)
public void Despawned(GameObject instance);
Tells Shipready a pool has taken an object back. It is not saved while it waits, and switching it off records nothing.
| Parameter | Description |
|---|---|
instance |
The pooled object. |
Find(string)
public Saveable Find(string id);
The live object with an id.
| Parameter | Description |
|---|---|
id |
The object's id. |
Returns: The object, or null when no live object has that id.
Forget(Scene)
public void Forget(Scene scene);
Drops the remembered state of one scene, so it starts from its defaults next time it loads.
| Parameter | Description |
|---|---|
scene |
The scene. |
GetLiveSaveables(List<Saveable>)
public int GetLiveSaveables(List<Saveable> into);
Every live Saveable: every one that has woken up and not been destroyed.
| Parameter | Description |
|---|---|
into |
The list to fill. It is cleared first. Null does nothing. |
Returns: How many were added.
HasRememberedState(Scene)
public bool HasRememberedState(Scene scene);
Whether Shipready remembers any state for a scene.
| Parameter | Description |
|---|---|
scene |
The scene. |
Returns: true when some category holds a section for it.
Spawned(GameObject)
public void Spawned(GameObject instance);
Tells Shipready a pool has handed an object out again, so it is saved again. An object the pool made inactive, which never woke up, gets its runtime id here.
| Parameter | Description |
|---|---|
instance |
The pooled object. |
SaveWriter #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class SaveWriter
What a game writes its state into. One writer wraps one object in the save tree, so a component that implements ISaveable gets a small, private place to put its values and never has to know where in the file it ends up.
Writing the same name twice replaces the earlier value and keeps its position, so the order of a readable save stays stable between runs.
Properties
Count
public int Count { get; }
How many values have been written.
Node
public SaveNode Node { get; }
The tree node this writer fills. Shipready reads it once capture has finished.
Methods
Create()
public static SaveWriter Create();
A writer over a new, empty object.
Returns: A writer with nothing in it.
For(SaveNode)
public static SaveWriter For(SaveNode node);
A writer over an existing object node, which is how Shipready hands a component the part of the save tree that belongs to it.
| Parameter | Description |
|---|---|
node |
The object node to write into. Null or a non-object node gets a fresh object. |
Returns: A writer over that node.
Has(string)
public bool Has(string name);
Whether a value with that name has been written.
| Parameter | Description |
|---|---|
name |
The value name. Compared exactly, including case. |
Returns: true when the name is present.
Remove(string)
public bool Remove(string name);
Removes a value.
| Parameter | Description |
|---|---|
name |
The value name. |
Returns: true when a value was removed.
Write(string, bool)
public void Write(string name, bool value);
Writes a true or false value.
| Parameter | Description |
|---|---|
name |
The value name. |
value |
The value to store. |
Write(string, Color)
public void Write(string name, Color value);
Writes a colour.
| Parameter | Description |
|---|---|
name |
The value name. |
value |
The value to store. |
Write(string, double)
public void Write(string name, double value);
Writes a double-precision number so that it reads back bit-exact.
| Parameter | Description |
|---|---|
name |
The value name. |
value |
The value to store. |
Write(string, float)
public void Write(string name, float value);
Writes a 32-bit floating-point number so that it reads back bit-exact.
| Parameter | Description |
|---|---|
name |
The value name. |
value |
The value to store. |
Write(string, int)
public void Write(string name, int value);
Writes a whole number.
| Parameter | Description |
|---|---|
name |
The value name. |
value |
The value to store. |
Write(string, long)
public void Write(string name, long value);
Writes a long whole number, keeping every digit.
| Parameter | Description |
|---|---|
name |
The value name. |
value |
The value to store. |
Write(string, Quaternion)
public void Write(string name, Quaternion value);
Writes a rotation.
| Parameter | Description |
|---|---|
name |
The value name. |
value |
The value to store. |
Write(string, string)
public void Write(string name, string value);
Writes text. Null is stored as no value rather than as an empty string.
| Parameter | Description |
|---|---|
name |
The value name. |
value |
The value to store. |
Write(string, Vector3)
public void Write(string name, Vector3 value);
Writes a position or any other 3D vector.
| Parameter | Description |
|---|---|
name |
The value name. |
value |
The value to store. |
Write<T>(string, T)
public void Write<T>(string name, T value);
Writes any supported value: the rest of the numbers, dates, durations, GUIDs, byte arrays, the remaining Unity types, enums, lists and arrays, any class or struct Unity can serialise, and a Dictionary with string or int keys and supported values (as WriteDictionary<TValue>(string, IDictionary<string, TValue>) writes it). Any other dictionary is written as no value, with a warning in the Console.
| Type parameter | Description |
|---|---|
T |
The value type. |
| Parameter | Description |
|---|---|
name |
The value name. |
value |
The value to store. |
WriteAsset(string, UnityEngine.Object)
public void WriteAsset(string name, UnityEngine.Object asset);
Writes a reference to one asset, as the identifier the Asset Registry gives it.
| Parameter | Description |
|---|---|
name |
The value name. |
asset |
The asset to store. Null is stored as no value. An asset missing from the registry is stored as no value and reported in the Console, not in the save report. |
WriteAssets<T>(string, IList<T>)
public void WriteAssets<T>(string name, IList<T> assets) where T : UnityEngine.Object;
Writes references to assets, such as the item definitions in an inventory, as the identifiers the Asset Registry gives them. Storing an identifier rather than a name is what lets a developer rename or move an asset without breaking existing saves.
| Type parameter | Description |
|---|---|
T |
The asset type. |
| Parameter | Description |
|---|---|
name |
The value name. |
assets |
The assets to store. Null is stored as no value. An entry that is null, or that is not in the Asset Registry, is stored as no value. An asset missing from the registry is reported in the Console with the code AssetNotRegistered, not in the save report. |
WriteDictionary<TValue>(string, IDictionary<int, TValue>)
public void WriteDictionary<TValue>(string name, IDictionary<int, TValue> values);
Writes a dictionary whose keys are whole numbers. The keys become member names in the file, written invariantly so the file is the same in every language setting.
| Type parameter | Description |
|---|---|
TValue |
The value type. |
| Parameter | Description |
|---|---|
name |
The value name. |
values |
The dictionary to store. Null is stored as no value. |
WriteDictionary<TValue>(string, IDictionary<string, TValue>)
public void WriteDictionary<TValue>(string name, IDictionary<string, TValue> values);
Writes a dictionary whose keys are text. Dictionaries are not something the Unity serialiser handles, which is why they go through Shipready API instead of the Field Picker.
| Type parameter | Description |
|---|---|
TValue |
The value type. |
| Parameter | Description |
|---|---|
name |
The value name. |
values |
The dictionary to store. Null is stored as no value. |
WriteEnum<TEnum>(string, TEnum)
public void WriteEnum<TEnum>(string name, TEnum value) where TEnum : struct;
Writes an enum by name, so that reordering or inserting enum values in a game update never changes what an existing save means.
| Type parameter | Description |
|---|---|
TEnum |
The enum type. |
| Parameter | Description |
|---|---|
name |
The value name. |
value |
The value to store. |
WriteList<T>(string, IList<T>)
public void WriteList<T>(string name, IList<T> values);
Writes a list or array of any supported value type.
| Type parameter | Description |
|---|---|
T |
The item type. |
| Parameter | Description |
|---|---|
name |
The value name. |
values |
The items to store. Null is stored as no value. |
WriteNode(string, SaveNode)
public void WriteNode(string name, SaveNode node);
Stores a tree node directly. Used by the savers and by migrations, which already hold nodes rather than values.
| Parameter | Description |
|---|---|
name |
The value name. |
node |
The node to store. Null is stored as no value. |
WriteObject(string)
public SaveWriter WriteObject(string name);
Starts a nested group of values, for a component that wants its own structure rather than a flat list of names.
| Parameter | Description |
|---|---|
name |
The group name. |
Returns: A writer over the nested group.
WriteObjectLink(string, UnityEngine.Object)
public void WriteObjectLink(string name, UnityEngine.Object target);
Writes a link to another saved object, or to a registered asset, so a load can link to it again: the same thing the Field Picker does for a ticked link field.
A saved object is a Saveable, its GameObject, or a component on a GameObject that has one; it is stored by the Saveable's id, so the link survives the object being re-created by a load. A ScriptableObject or prefab is stored by its id in the Asset Registry or the Prefab Registry. Read it back with SaveReader.ReadObjectLink<T>(string, Action<T>).
| Parameter | Description |
|---|---|
name |
The value name. |
target |
What to link to. Null is stored as an empty link. An object with no Saveable, or an asset in neither registry, is stored as an empty link and reported: in the save's report during a save, otherwise in the Console. |
WriteObjectLinks<T>(string, IList<T>)
public void WriteObjectLinks<T>(string name, IList<T> targets) where T : UnityEngine.Object;
Writes a list of links to saved objects or registered assets, each as WriteObjectLink(string, UnityEngine.Object) writes one. Entries that cannot be linked are kept as empty links, so the list keeps its length. Read it back with SaveReader.ReadObjectLinks<T>(string, Action<List<T>>).
| Type parameter | Description |
|---|---|
T |
The type of the entries: GameObject, a component type, or an asset type. |
| Parameter | Description |
|---|---|
name |
The value name. |
targets |
What to link to. Null is stored as no value. |
SlotIndex #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class SlotIndex
A small cache of what each slot holds, so a menu with ninety-nine slots does not have to open ninety-nine files to draw itself.
It is only ever a cache. Each entry records the size and the time of the file it describes, and an entry is used only while both still match, so a save written by anything other than Shipready, a file restored from a cloud backup or a hand edit all make Shipready read the real file again. A cache that can go stale without noticing would show a player the wrong save, which is worse than being slow.
Properties
Count
public int Count { get; }
How many slots the cache knows about.
IsDirty
public bool IsDirty { get; }
Whether anything has changed since the cache was last written.
Constants
FileName
public const string FileName = "slots.index";
The file the cache is kept in. The extension is deliberately not the save extension, so a Steam Auto-Cloud pattern of *.save never uploads it.
Methods
Clear()
public void Clear();
Forgets everything.
DeleteFile(ISaveStorage)
public static StorageOutcome DeleteFile(ISaveStorage storage);
Deletes the cache file, which Diagnostics offers as a repair.
| Parameter | Description |
|---|---|
storage |
Where the files live. |
Returns: What happened.
Load(ISaveStorage)
public bool Load(ISaveStorage storage);
Reads the cache. A missing or unreadable cache is not a failure: it just means every slot is read from its own file this time.
| Parameter | Description |
|---|---|
storage |
Where the files live. |
Returns: true when a cache was read.
Remove(string)
public bool Remove(string fileName);
Forgets what a file held.
| Parameter | Description |
|---|---|
fileName |
The save file name. |
Returns: true when there was something to forget.
Save(ISaveStorage)
public bool Save(ISaveStorage storage);
Writes the cache, if anything has changed. A failure is not worth reporting to a game: the cache only ever saves time, and Shipready reads the real files without it.
| Parameter | Description |
|---|---|
storage |
Where the files live. |
Returns: true when the cache was written.
Set(ISaveStorage, string, SlotInfo)
public void Set(ISaveStorage storage, string fileName, SlotInfo info);
Remembers the info for a file, together with the size and time it was read at.
| Parameter | Description |
|---|---|
storage |
Where the files live. |
fileName |
The save file name. |
info |
What the file holds. Null removes the entry. |
Set(string, SlotInfo, long, DateTime)
public void Set(string fileName, SlotInfo info, long fileBytes, DateTime writtenUtc);
Remembers the info for a file together with a size and time the caller measured, which is how a save records its own slot straight after writing it, before anything else can have changed the file.
| Parameter | Description |
|---|---|
fileName |
The save file name. |
info |
What the file holds. Null removes the entry. |
fileBytes |
The size of the file the info describes. |
writtenUtc |
When the file the info describes was last written. |
TryGet(ISaveStorage, string, SlotInfo)
public bool TryGet(ISaveStorage storage, string fileName, out SlotInfo info);
The cached info for a file, but only when it still matches the file on disk.
| Parameter | Description |
|---|---|
storage |
Where the files live. |
fileName |
The save file name. |
info |
The cached info, or null when there is nothing usable. |
Returns: true when the cache can be trusted for this file.
SlotInfo #
class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public sealed class SlotInfo
What the save menu shows about one slot, and what Shipready records about it. It is kept in the readable part of every save file, so the menu can list slots without unpacking or decrypting anything.
Properties
BackupCount
public int BackupCount { get; set; }
How many backups of this save exist.
Exists
public bool Exists { get; set; }
Whether there is a save in this slot at all.
FileBytes
public long FileBytes { get; set; }
How many bytes the save file holds.
FileName
public string FileName { get; set; }
The storage-relative file name this came from.
GameVersion
public string GameVersion { get; set; }
The game version that wrote the save.
HasValidBackup
public bool HasValidBackup { get; set; }
Whether a backup (or the temporary file left by a save that was cut short) reads as a valid save. The backups are read to find out only when the main file is damaged or missing, which is when it matters; for a healthy slot this is simply whether any backup exists, so listing ninety-nine slots never reads ninety-nine backups.
IsAutosave
public bool IsAutosave { get; set; }
Whether this is one of the rotating autosaves rather than a manual slot.
IsDamaged
public bool IsDamaged { get; set; }
Whether the main file is damaged, or the slot cannot be read at all. A backup may still be usable: see HasValidBackup. With automatic fallback on, such a slot still loads, from its newest valid backup; with it off, the menu offers Restore backup instead. While the main file is damaged, the name, time and the rest describe the newest valid copy, which is what a load or a restore would bring back.
IsFromNewerVersion
public bool IsFromNewerVersion { get; set; }
Whether the save is from a newer version of the game, which means it cannot be loaded. The menu shows a badge and does not offer to load it.
IsQuicksave
public bool IsQuicksave { get; set; }
Whether this is the quicksave rather than a manual slot.
Location
public string Location { get; set; }
Where the player was, as the game chose to describe it.
Name
public string Name { get; set; }
The name the game gave the save, such as a chapter title.
Packing
public SavePacking Packing { get; set; }
How the file is packed.
PlaytimeSeconds
public double PlaytimeSeconds { get; set; }
How long the player has played, in seconds.
RecoveredFromBackup
public bool RecoveredFromBackup { get; set; }
Whether this info was read from a copy other than the main file: a backup, or the temporary file left by a save that was cut short.
SavedUtc
public DateTime SavedUtc { get; set; }
When the save was written, in UTC. Show it with ToLocalTime.
SaveVersion
public int SaveVersion { get; set; }
The save version the file is at.
SlotNumber
public int SlotNumber { get; set; }
Which slot this is, counting from 1. Zero for a file that is not a slot.
Status
public SaveErrorCode Status { get; set; }
The code the last read of this slot reported.
Summary
public string[] Summary { get; set; }
Up to four short lines the game supplies, such as Day 12 and $4,300. Never null.
ThumbnailFileName
public string ThumbnailFileName { get; set; }
The storage-relative name of the thumbnail beside the save, if there is one.
Constants
DamagedSaveName
public const string DamagedSaveName = "Damaged save";
The name a slot gets when it is damaged and no copy of it could tell its real name. A menu can show its own translated wording instead.
MaximumSummaryLines
public const int MaximumSummaryLines = 4;
How many summary lines a game may supply.
Methods
Clone()
public SlotInfo Clone();
A copy of this slot info.
Returns: A new instance holding the same values.
CreateEmpty(int, string)
public static SlotInfo CreateEmpty(int slotNumber, string fileName);
An empty slot, for the menu to draw a blank card with.
| Parameter | Description |
|---|---|
slotNumber |
Which slot it is. |
fileName |
The file name it would have. |
Returns: A new, empty slot info.
ReadFrom(SaveReader)
public void ReadFrom(SaveReader r);
Reads the parts a save file keeps. The rest, such as the backup count and the status, are filled in by whoever read the file.
| Parameter | Description |
|---|---|
r |
Where to read from. Null does nothing. |
ToString()
public override string ToString();
The slot as one line, for logs and the Save Inspector.
Returns: A short description. Never null.
WriteTo(SaveWriter)
public void WriteTo(SaveWriter w);
Writes the parts a save file keeps into the file info section.
| Parameter | Description |
|---|---|
w |
Where to write. Null does nothing. |
ThumbnailCapture #
static class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public static class ThumbnailCapture
Takes the picture a slot card shows: a camera renders the game once into a small temporary texture, which is read back. Screen-space overlay UI, such as the HUD and the save menu itself, is not drawn by cameras, so it never appears in a thumbnail. The save menu uses it before a save, and Shipready before every slot save, autosave and quicksave while SaveKitSettings.CaptureAutosaveThumbnails is on.
It renders the camera the way the active render pipeline renders it, with no code of its own for any pipeline. With no camera, or no graphics device (a server build or a -nographics run), there is simply no picture.
Methods
CanRender()
public static bool CanRender();
Whether there is a graphics device to render with. False in a server build and a -nographics run.
Returns: true when a camera can be rendered.
Capture(Camera)
public static Texture2D Capture(Camera camera);
Renders a camera into a new readable texture of thumbnail size, 320×180.
| Parameter | Description |
|---|---|
camera |
The camera to render. Null uses Camera.main. |
Returns: The picture, which the caller destroys, or null when there is no camera or no graphics device.
Capture(Camera, int, int)
public static Texture2D Capture(Camera camera, int width, int height);
Renders a camera into a new readable texture of a given size.
| Parameter | Description |
|---|---|
camera |
The camera to render. Null uses Camera.main. |
width |
The width in pixels, at least 8. |
height |
The height in pixels, at least 8. |
Returns: The picture, which the caller destroys, or null when there is no camera or no graphics device.
Thumbnails #
static class in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public static class Thumbnails
The small picture a slot card shows. It is stored beside the save as a PNG rather than inside it, so the menu can show a wall of thumbnails without reading a single save file, and so a thumbnail never bloats a save that a player syncs to the cloud.
The file extension is deliberately not the save extension, which keeps thumbnails out of a Steam Auto-Cloud pattern of *.save.
Constants
Height
public const int Height = 180;
How tall a stored thumbnail is.
Suffix
public const string Suffix = ".thumb.png";
The suffix a thumbnail file carries.
Width
public const int Width = 320;
How wide a stored thumbnail is.
Methods
Delete(ISaveStorage, string)
public static StorageOutcome Delete(ISaveStorage storage, string saveFileName);
Removes the thumbnail for a save. Deleting one that is not there succeeds.
| Parameter | Description |
|---|---|
storage |
Where the files live. |
saveFileName |
The save file the thumbnail belongs to. |
Returns: What happened.
DestroyTexture(Texture2D)
public static void DestroyTexture(Texture2D texture);
Destroys a texture Shipready made. Outside Play Mode, in Editor tests and tools, Unity does not allow a delayed destroy, so the texture goes at once there.
| Parameter | Description |
|---|---|
texture |
The texture to destroy. Null does nothing. |
Encode(Texture2D, byte[])
public static StorageOutcome Encode(Texture2D source, out byte[] png);
Scales a picture down to thumbnail size and encodes it as a PNG. Uses Unity, so call it on the main thread. The picture handed in is left alone.
| Parameter | Description |
|---|---|
source |
The picture to encode. It has to be readable. |
png |
The encoded picture, or null on failure. |
Returns: What happened.
GetFileName(string)
public static string GetFileName(string saveFileName);
The thumbnail file name for a save.
| Parameter | Description |
|---|---|
saveFileName |
The save file name, for example slot_01.save. |
Returns: The thumbnail file name, or null when there is no save file name.
Read(ISaveStorage, string)
public static Texture2D Read(ISaveStorage storage, string saveFileName);
Reads the thumbnail for a save.
| Parameter | Description |
|---|---|
storage |
Where the files live. |
saveFileName |
The save file the thumbnail belongs to. |
Returns: The picture, or null when there is no thumbnail. The caller owns the texture and should destroy it when the card it is on goes away.
Scale(Texture2D, int, int)
public static Texture2D Scale(Texture2D source, int width, int height);
Scales a picture down, keeping the shape it was and filling the rest with black, so every slot card is the same size whatever aspect ratio the player plays at.
| Parameter | Description |
|---|---|
source |
The picture to scale. Must be readable. |
width |
How wide the result should be. |
height |
How tall the result should be. |
Returns: A new texture, or null when the source could not be read.
Write(ISaveStorage, string, byte[])
public static StorageOutcome Write(ISaveStorage storage, string saveFileName, byte[] png);
Writes a thumbnail that is already encoded as a PNG beside a save. It touches no Unity object, so Shipready calls it on a background thread straight after a save is in place.
| Parameter | Description |
|---|---|
storage |
Where the files live. |
saveFileName |
The save file the thumbnail belongs to. |
png |
The encoded picture, as Encode(Texture2D, byte[]) produces it. |
Returns: What happened.
Write(ISaveStorage, string, Texture2D)
public static StorageOutcome Write(ISaveStorage storage, string saveFileName, Texture2D source);
Writes a thumbnail beside a save, scaling it down first. Uses Unity to scale and encode the picture, so call it on the main thread.
| Parameter | Description |
|---|---|
storage |
Where the files live. |
saveFileName |
The save file the thumbnail belongs to. |
source |
The picture to store, usually a screenshot. It has to be readable, which a texture from ScreenCapture.CaptureScreenshotAsTexture is. |
Returns: What happened.
WorldLoadMode #
enum in RareGeometry.Shipready.Save · assembly RareGeometry.Shipready.Save
public enum WorldLoadMode
How a load treats scenes.
Values
Namespace RareGeometry.Shipready.Save.Codecs #
AesHmacCodec #
static class in RareGeometry.Shipready.Save.Codecs · assembly RareGeometry.Shipready.Save
public static class AesHmacCodec
Optional encryption for the data section of a save: AES-256 in CBC mode with a fresh random starting block for every write, and an HMAC-SHA256 signature over the header and the encrypted bytes. Encrypt first, then sign, which is the order that makes the signature trustworthy.
The payload is laid out as the 16-byte starting block, then the encrypted bytes, then the 32-byte signature. A single changed byte anywhere in it fails the signature check.
Encryption here stops a player opening a save in a text editor and changing their gold. It is not anti-cheat and must never be used for passwords or payment details: the passphrase ships inside the game, and a Mono build is straightforward to decompile.
Constants
IvBytes
public const int IvBytes = 16;
How many bytes the random starting block takes at the front of the payload.
KeyCheckBytes
public const int KeyCheckBytes = 8;
How many bytes of the key check value are stored in a save header.
MacBytes
public const int MacBytes = 32;
How many bytes the signature takes at the end of the payload.
Methods
ComputeKeyCheck(SaveKeys)
public static string ComputeKeyCheck(SaveKeys keys);
A short value stored in the save header that says which passphrase wrote the file, without revealing anything about it. It lets the loader tell the difference between a save written with another passphrase and one that has been tampered with.
| Parameter | Description |
|---|---|
keys |
The keys to describe. Null returns an empty string. |
Returns: The key check value as base64, or an empty string.
Encrypt(byte[], SaveKeys, byte[])
public static byte[] Encrypt(byte[] plaintext, SaveKeys keys, byte[] associatedData);
Encrypts and signs a byte array.
| Parameter | Description |
|---|---|
plaintext |
The bytes to protect. Null is treated as empty. |
keys |
The keys to use. Null returns null. |
associatedData |
Extra bytes the signature covers but that are not encrypted, which is the readable header of the file. Changing the header after the fact then fails the check. |
Returns: The payload, or null when there are no keys.
MatchesKeyCheck(SaveKeys, string)
public static bool MatchesKeyCheck(SaveKeys keys, string keyCheck);
Whether a key check value from a save header was written by these keys.
| Parameter | Description |
|---|---|
keys |
The keys to test. Null returns false. |
keyCheck |
The value from the header. An empty value returns true, because files written before Shipready stored a key check cannot be told apart this way. |
Returns: true when the keys match, or when the file carries no key check.
TryDecrypt(byte[], SaveKeys, byte[], byte[], SaveErrorCode, string)
public static bool TryDecrypt(byte[] payload, SaveKeys keys, byte[] associatedData, out byte[] plaintext, out SaveErrorCode code, out string error);
Checks the signature and decrypts a payload.
| Parameter | Description |
|---|---|
payload |
The payload written by Encrypt(byte[], SaveKeys, byte[]). |
keys |
The keys to use. Null fails with SaveErrorCode.EncryptionKeyWrong. |
associatedData |
The same extra bytes that were passed when encrypting. |
plaintext |
The decrypted bytes, or null on failure. |
code |
Why it failed, or SaveErrorCode.None on success. |
error |
A plain-English reason, or null on success. |
Returns: true when the signature matched and the bytes decrypted.
GzipCodec #
static class in RareGeometry.Shipready.Save.Codecs · assembly RareGeometry.Shipready.Save
public static class GzipCodec
GZip compression for the data section of a save. Compression is off by default because a typical save is already small, but JSON compresses several times over, so a large world is worth packing.
The output is deterministic: the same input always produces the same bytes, which keeps the acceptance tests able to compare files directly.
Methods
Compress(byte[])
public static byte[] Compress(byte[] data);
Compresses a byte array.
| Parameter | Description |
|---|---|
data |
The bytes to compress. Null or empty comes back as an empty array. |
Returns: The compressed bytes.
LooksLikeGzip(byte[])
public static bool LooksLikeGzip(byte[] data);
Whether a byte array starts with a GZip header. Used when checking a file whose header says it is compressed.
| Parameter | Description |
|---|---|
data |
The bytes to look at. Null returns false. |
Returns: true when the first two bytes are the GZip marker.
TryDecompress(byte[], byte[], string)
public static bool TryDecompress(byte[] data, out byte[] result, out string error);
Decompresses a byte array.
| Parameter | Description |
|---|---|
data |
The compressed bytes. |
result |
The decompressed bytes, or null when decompression failed. |
error |
Why decompression failed. Null on success. |
Returns: true when the bytes decompressed.
KeyDerivation #
static class in RareGeometry.Shipready.Save.Codecs · assembly RareGeometry.Shipready.Save
public static class KeyDerivation
Turns a developer passphrase into encryption keys, once per run.
Stretching the passphrase with PBKDF2 takes a noticeable fraction of a second on purpose, so the result is cached: the first encrypted save pays for it and the rest do not. The cache is cleared when static state resets, so turning off domain reload cannot leave a stale key behind after the passphrase is changed in the Inspector.
This is not anti-cheat. The passphrase ships inside the game, so a determined player can find it, especially in a Mono build. What it does do is stop a save being edited in a text editor, and notice when one has been.
Constants
KeyBytes
public const int KeyBytes = 32;
How many bytes each of the two keys holds.
Methods
ClearCache()
public static void ClearCache();
Forgets the cached keys, so the next save derives them again. Called when the passphrase changes and whenever static state resets.
CreateRandomSalt()
public static string CreateRandomSalt();
A fresh random salt as base64, for the Setup Wizard to put into the settings asset.
Returns: 16 random bytes as base64.
Derive(string, string, int)
public static SaveKeys Derive(string passphrase, string saltBase64, int iterations);
Derives the keys without touching the cache. Tests use this; games use GetKeys(SaveFileOptions).
| Parameter | Description |
|---|---|
passphrase |
The developer passphrase. Null or empty returns null. |
saltBase64 |
The salt as base64. Empty falls back to the product salt. |
iterations |
How many PBKDF2 rounds to run. |
Returns: The keys, or null when the passphrase is empty.
GetKeys(SaveFileOptions)
public static SaveKeys GetKeys(SaveFileOptions options);
The keys for a set of file options, derived once and then reused.
| Parameter | Description |
|---|---|
options |
The options holding the passphrase, salt and iteration count. |
Returns: The keys, or null when the options are null or the passphrase is empty.
GetKeys(string, string, int)
public static SaveKeys GetKeys(string passphrase, string saltBase64, int iterations);
The keys for a passphrase, derived once and then reused.
| Parameter | Description |
|---|---|
passphrase |
The developer passphrase. Null or empty returns null. |
saltBase64 |
The salt as base64. An empty salt falls back to one derived from the product name, which keeps old saves loadable for a game that never set one. |
iterations |
How many PBKDF2 rounds to run. |
Returns: The keys, or null when the passphrase is empty.
SaveKeys #
class in RareGeometry.Shipready.Save.Codecs · assembly RareGeometry.Shipready.Save
public sealed class SaveKeys
The two keys an encrypted save needs: one to encrypt with and a separate one to sign with. Using separate keys is what makes the tamper check meaningful.
Properties
EncryptionKey
public byte[] EncryptionKey { get; }
The 32-byte key used for AES-256.
SigningKey
public byte[] SigningKey { get; }
The 32-byte key used for HMAC-SHA256.
Namespace RareGeometry.Shipready.Save.Coop #
IPlayerIdentity #
interface in RareGeometry.Shipready.Save.Coop · assembly RareGeometry.Shipready.Save
public interface IPlayerIdentity
Maps a connected player to a stable id string that survives the player leaving and coming back, such as a Steam ID. The host keeps each player's data in SaveKit.Players under that id.
Methods
TryGetPlayerId(ulong, string)
bool TryGetPlayerId(ulong connectionId, out string playerId);
The stable id of a connected player.
| Parameter | Description |
|---|---|
connectionId |
The network library's id for the connection. |
playerId |
The stable id, or null when the player is not known yet. |
Returns: true when the player has a stable id.
ISaveAuthority #
interface in RareGeometry.Shipready.Save.Coop · assembly RareGeometry.Shipready.Save
public interface ISaveAuthority
Decides who may save and load world data. In co-op only the host may; a solo game needs no authority at all, because SaveKit.Authority left at null always allows it.
When the authority says no, every slot, autosave and quicksave save, load and delete returns SaveErrorCode.HostOnly without touching storage. Saving and loading the global file stays allowed, so a client keeps its own settings.
Example
sealed class NgoAuthority : ISaveAuthority
{
public bool HasSaveAuthority { get { return NetworkManager.Singleton.IsServer; } }
}
SaveKit.Authority = new NgoAuthority();
Properties
HasSaveAuthority
bool HasSaveAuthority { get; }
Whether this game instance may save and load world data right now.
ISpawnHandler #
interface in RareGeometry.Shipready.Save.Coop · assembly RareGeometry.Shipready.Save
public interface ISpawnHandler
Creates and removes runtime objects for Shipready. A load re-creates the objects that were spawned at runtime through this hook, so a pool, a network library or Addressables can make them. Left at null, Shipready uses Instantiate and Destroy.
Shipready gives the new object its saved id itself, straight after Spawn(GameObject, Vector3, Quaternion, Transform) returns, so the hook only has to make the object.
Methods
Despawn(GameObject)
void Despawn(GameObject instance);
Removes an object Shipready no longer needs, such as a runtime object a load replaces.
| Parameter | Description |
|---|---|
instance |
The object to remove. |
Spawn(GameObject, Vector3, Quaternion, Transform)
GameObject Spawn(GameObject prefab, Vector3 position, Quaternion rotation, Transform parent);
Makes an object from a registered prefab.
| Parameter | Description |
|---|---|
prefab |
The prefab from the Prefab Registry. |
position |
Where to put it. Shipready sets the saved position afterwards. |
rotation |
Which way round. Shipready sets the saved rotation afterwards. |
parent |
The parent, or null for the scene root. |
Returns: The new object, or null when it could not be made.
PlayerData #
class in RareGeometry.Shipready.Save.Coop · assembly RareGeometry.Shipready.Save
public sealed class PlayerData
Per-player data in a co-op game: position, inventory, anything that belongs to one player rather than to the world. The host keeps it, under the stable id the game supplies (see IPlayerIdentity), and it is saved inside the host's slot beside the categories, as players.<player id>.<category>.
A save writes each player's values for every category it saves; a load brings them back, so a player who rejoins gets their data again and a player the save does not know starts from defaults. Reach it through SaveKit.Players.
Example
SaveData mine = SaveKit.Players.For(steamId);
mine.Set("position", transform.position, "Progress");
Vector3 back = SaveKit.Players.For(steamId).Get("position", spawnPoint, "Progress");
Methods
Clear()
public void Clear();
Forgets every player, which is what a new game wants.
For(string)
public SaveData For(string playerId);
The data of one player, created empty the first time it is asked for. The object is kept for as long as Shipready runs, so a game may hold on to it; a load refills it in place.
| Parameter | Description |
|---|---|
playerId |
The player's stable id. Null or empty gives null. |
Returns: The player's data, or null for an unusable id.
ForConnection(ulong)
public SaveData ForConnection(ulong connectionId);
The data of a connected player, found through SaveKit.Identity and created empty the first time it is asked for.
When the connection cannot be matched to a stable id, because no identity is set, the identity does not name it or the identity failed, this returns null and reports SaveErrorCode.PlayerUnknown (SK141) in the Console, once per connection until it is matched. The game then treats the player as new, with defaults.
| Parameter | Description |
|---|---|
connectionId |
The network library's id for the connection. |
Returns: The player's data, or null when the player has no stable id.
GetPlayerIds(List<string>)
public int GetPlayerIds(List<string> into);
The ids of every player that has at least one value, in the order they were first seen.
| Parameter | Description |
|---|---|
into |
The list to fill. It is cleared first. Null does nothing. |
Returns: How many ids were added.
Has(string)
public bool Has(string playerId);
Whether any value is held for a player.
| Parameter | Description |
|---|---|
playerId |
The player's stable id. |
Returns: true when the player has at least one value.
Remove(string)
public bool Remove(string playerId);
Forgets a player. The next save no longer writes them.
| Parameter | Description |
|---|---|
playerId |
The player's stable id. |
Returns: true when the player was known.
TryGetPlayerId(ulong, string)
public bool TryGetPlayerId(ulong connectionId, out string playerId);
The stable id of a connected player, asked of SaveKit.Identity. This is the quiet form for code that asks again later: only an identity that throws is reported, as SaveErrorCode.PlayerUnknown in the Console.
| Parameter | Description |
|---|---|
connectionId |
The network library's id for the connection. |
playerId |
The stable id, or null. |
Returns: true when the game's identity named the player. false when there is no identity, it does not know the player, or it failed.
Namespace RareGeometry.Shipready.Save.Data #
SaveNode #
class in RareGeometry.Shipready.Save.Data · assembly RareGeometry.Shipready.Save
public sealed class SaveNode
One node of the save tree, which is Shipready data model that everything else reads: the JSON writer and reader, the menu, the Save Inspector, Diagnostics and migrations.
Numbers are held as the exact text they were written with rather than as a Double. That is what makes a Single come back bit-exact, keeps a Int64 past 2^53 intact, and makes a readable save look the way a developer expects instead of showing 0.100000001490116 where the game wrote 0.1.
Object members keep their insertion order, so writing the same tree twice always produces the same bytes. The checksum relies on that.
Properties
BoolValue
public bool BoolValue { get; }
The value of a SaveNodeKind.Bool node. False for every other kind.
IsArray
public bool IsArray { get; }
Whether this node holds numbered items.
IsNull
public bool IsNull { get; }
Whether this node holds no value.
IsObject
public bool IsObject { get; }
Whether this node holds named members.
ItemCount
public int ItemCount { get; }
How many items this array node holds. Zero for every other kind.
Kind
public SaveNodeKind Kind { get; }
What this node holds.
MemberCount
public int MemberCount { get; }
How many named members this object node holds. Zero for every other kind.
Text
public string Text { get; }
The text of a SaveNodeKind.String node, or the exact number text of a SaveNodeKind.Number node. Empty for every other kind.
Constants
NegativeInfinityText
public const string NegativeInfinityText = "-Infinity";
The text used for negative infinity, so JSON stays valid.
NotANumberText
public const string NotANumberText = "NaN";
The text used for a number that is not a number, so JSON stays valid.
PositiveInfinityText
public const string PositiveInfinityText = "Infinity";
The text used for positive infinity, so JSON stays valid.
Methods
AddItem(SaveNode)
public void AddItem(SaveNode value);
Adds an item to the end.
| Parameter | Description |
|---|---|
value |
The item to add. Null becomes a null node. |
ClearItems()
public void ClearItems();
Removes every item of this array node.
ClearMembers()
public void ClearMembers();
Removes every member of this object node.
Clone()
public SaveNode Clone();
A deep copy of this node. Migrations use it to keep the pre-migration tree while they build the upgraded one.
Returns: A new node that shares nothing with this one.
CountNodes()
public int CountNodes();
How many nodes this subtree holds, counting this one. The Save Inspector shows it and the report uses it as a value count.
Returns: One or more.
DeepEquals(SaveNode, SaveNode)
public static bool DeepEquals(SaveNode a, SaveNode b);
Whether two trees hold the same values in the same order. Used by tests and by the Save Inspector comparison view.
| Parameter | Description |
|---|---|
a |
The first tree. May be null. |
b |
The second tree. May be null. |
Returns: true when both are null or both hold exactly the same tree.
FromBool(bool)
public static SaveNode FromBool(bool value);
A node that holds true or false.
| Parameter | Description |
|---|---|
value |
The value to hold. |
Returns: A new bool node.
FromNumberText(string)
public static SaveNode FromNumberText(string numberText);
A node that holds a number, given the exact text to store. Use ValueConverters rather than calling this with hand-built text, so that the invariant number formatting rules are applied in one place.
| Parameter | Description |
|---|---|
numberText |
The number text to store, already formatted invariantly. |
Returns: A new number node, or a null node when the text is null or empty.
FromString(string)
public static SaveNode FromString(string value);
A node that holds text.
| Parameter | Description |
|---|---|
value |
The text to hold. Null becomes a null node. |
Returns: A new string node, or a null node when the text is null.
GetItem(int)
public SaveNode GetItem(int index);
The item at a position.
| Parameter | Description |
|---|---|
index |
The position, from zero. |
Returns: The item, or null when the position does not exist.
GetMember(string)
public SaveNode GetMember(string name);
The value of a named member.
| Parameter | Description |
|---|---|
name |
The member name. Compared exactly, including case. |
Returns: The member value, or null when there is no such member.
GetMemberAt(int)
public SaveNode GetMemberAt(int index);
The value of a member by position, in insertion order.
| Parameter | Description |
|---|---|
index |
The position, from zero. |
Returns: The member value, or null when the position does not exist.
GetMemberName(int)
public string GetMemberName(int index);
The name of a member by position, in insertion order.
| Parameter | Description |
|---|---|
index |
The position, from zero. |
Returns: The member name, or an empty string when the position does not exist.
GetOrAddArray(string)
public SaveNode GetOrAddArray(string name);
The named member as an array node, adding an empty one when it is missing or is not an array.
| Parameter | Description |
|---|---|
name |
The member name. |
Returns: An array node, or null when this node is not an object.
GetOrAddObject(string)
public SaveNode GetOrAddObject(string name);
The named member as an object node, adding an empty one when it is missing or is not an object. Saves the caller a null check on every nested write.
| Parameter | Description |
|---|---|
name |
The member name. |
Returns: An object node, or null when this node is not an object.
HasMember(string)
public bool HasMember(string name);
Whether this object node has a member with that name.
| Parameter | Description |
|---|---|
name |
The member name. Compared exactly, including case. |
Returns: true when the member exists.
InsertItem(int, SaveNode)
public void InsertItem(int index, SaveNode value);
Inserts an item at a position.
| Parameter | Description |
|---|---|
index |
Where to insert. Clamped to the current range. |
value |
The item to insert. Null becomes a null node. |
MeasureDepth(int)
public int MeasureDepth(int limit);
How deeply this subtree nests, counting this node as level 1, stopping as soon as the limit is passed.
Shipready reads files only up to a fixed nesting limit, so it has to refuse to write a tree deeper than that. Writing one would produce a file that verifies as correct and then can never be read back, which is a far worse failure than refusing the save.
| Parameter | Description |
|---|---|
limit |
The depth to stop counting at. The result is never more than this plus one, which is enough to tell that the limit was passed. |
Returns: The nesting depth, capped just above the limit.
NewArray()
public static SaveNode NewArray();
A node that holds numbered items.
Returns: A new, empty array node.
NewNull()
public static SaveNode NewNull();
A node with no value.
Returns: A new null node.
NewObject()
public static SaveNode NewObject();
A node that holds named members.
Returns: A new, empty object node.
RemoveItemAt(int)
public bool RemoveItemAt(int index);
Removes the item at a position.
| Parameter | Description |
|---|---|
index |
The position, from zero. |
Returns: true when an item was removed.
RemoveMember(string)
public bool RemoveMember(string name);
Removes a named member.
| Parameter | Description |
|---|---|
name |
The member name. |
Returns: true when a member was removed.
RenameMember(string, string)
public bool RenameMember(string from, string to);
Renames a member, keeping its position and value. Used by migrations. Renaming onto a name that already exists replaces that member and removes the old one.
| Parameter | Description |
|---|---|
from |
The current name. |
to |
The new name. |
Returns: true when a member was renamed.
SetItem(int, SaveNode)
public void SetItem(int index, SaveNode value);
Replaces the item at a position.
| Parameter | Description |
|---|---|
index |
The position, from zero. Out of range positions are ignored. |
value |
The item to store. Null becomes a null node. |
SetMember(string, SaveNode)
public void SetMember(string name, SaveNode value);
Adds a member, or replaces the value of one that already exists. A replaced member keeps its original position, so the order of a save stays stable across writes.
| Parameter | Description |
|---|---|
name |
The member name. Null is ignored. An empty name is kept, because JSON allows one and a dictionary saved through Shipready API may genuinely have an empty-string key. |
value |
The value to store. Null becomes a null node. |
ToString()
public override string ToString();
This node as compact JSON. Handy in a debugger and in test failure messages.
Returns: The node as JSON on one line.
TryGetMember(string, SaveNode)
public bool TryGetMember(string name, out SaveNode value);
The value of a named member, in the try pattern.
| Parameter | Description |
|---|---|
name |
The member name. Compared exactly, including case. |
value |
The member value, or null when there is no such member. |
Returns: true when the member exists.
SaveNodeKind #
enum in RareGeometry.Shipready.Save.Data · assembly RareGeometry.Shipready.Save
public enum SaveNodeKind
What one node in a save tree holds.
Values
ValueConverters #
static class in RareGeometry.Shipready.Save.Data · assembly RareGeometry.Shipready.Save
public static class ValueConverters
Turns the supported value types into save tree nodes and back. Every number, date and identifier goes through here, which is how Shipready keeps one promise that quietly breaks a lot of save systems: the file is byte-identical whatever language the machine is set to.
A float is written with the fewest significant digits, seven, eight or nine, that read back as exactly the same float, and a double with fifteen, sixteen or seventeen; so a readable save shows 0.8 where the game stored 0.8f, and still reads back bit-exact. Whole numbers are written as whole numbers, and negative zero as -0. Decimals keep every digit. NaN and infinity have no JSON spelling, so they are written as the strings NaN, Infinity and -Infinity.
Constants and fields
Culture
public static readonly CultureInfo Culture;
The one culture every number, date and identifier in a save is written with.
DateTimeFormat
public const string DateTimeFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ";
The format a DateTime is written with: round-trip, always UTC.
DoubleFormat
public const string DoubleFormat = "G17";
The longest format a Double is written with: seventeen significant digits always read back bit-exact. Shorter text is written whenever it reads back the same.
HeaderDateTimeFormat
public const string HeaderDateTimeFormat = "yyyy-MM-ddTHH:mm:ssZ";
The shorter date format used for the savedUtc field of a save header.
SingleFormat
public const string SingleFormat = "G9";
The longest format a Single is written with: nine significant digits always read back bit-exact. Shorter text is written whenever it reads back the same.
TimeSpanFormat
public const string TimeSpanFormat = "c";
The format a TimeSpan is written with: round-trip and readable.
Methods
FormatDecimal(decimal)
public static string FormatDecimal(decimal value);
Formats a decimal with every digit it has, in any language setting.
| Parameter | Description |
|---|---|
value |
The value to format. |
Returns: The number text to store.
FormatDouble(double)
public static string FormatDouble(double value);
Formats a 64-bit float so it reads back bit-exact, in any language setting.
| Parameter | Description |
|---|---|
value |
The value to format. |
Returns: The number text to store.
FormatInt64(long)
public static string FormatInt64(long value);
Formats a signed whole number, in any language setting.
| Parameter | Description |
|---|---|
value |
The value to format. |
Returns: The number text to store.
FormatSingle(float)
public static string FormatSingle(float value);
Formats a 32-bit float so it reads back bit-exact, in any language setting.
| Parameter | Description |
|---|---|
value |
The value to format. |
Returns: The number text to store.
FormatUInt64(ulong)
public static string FormatUInt64(ulong value);
Formats an unsigned whole number, in any language setting.
| Parameter | Description |
|---|---|
value |
The value to format. |
Returns: The number text to store.
From(bool)
public static SaveNode From(bool value);
A node holding a bool.
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: A bool node.
From(Bounds)
public static SaveNode From(Bounds value);
A node holding bounds, as [centre x, centre y, centre z, size x, size y, size z].
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: An array node of six numbers.
From(BoundsInt)
public static SaveNode From(BoundsInt value);
A node holding whole-number bounds, as [position x, position y, position z, size x, size y, size z].
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: An array node of six numbers.
From(byte)
public static SaveNode From(byte value);
A node holding a byte.
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: A number node.
From(byte[])
public static SaveNode From(byte[] value);
A node holding raw bytes, stored as base64 text.
| Parameter | Description |
|---|---|
value |
The bytes to store. Null becomes a null node. |
Returns: A string node, or a null node.
From(char)
public static SaveNode From(char value);
A node holding one character, stored as a one-character piece of text.
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: A string node.
From(Color)
public static SaveNode From(Color value);
A node holding a colour, as [r, g, b, a] with values from 0 to 1.
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: An array node of four numbers.
From(Color32)
public static SaveNode From(Color32 value);
A node holding a byte colour, as [r, g, b, a] with values from 0 to 255.
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: An array node of four numbers.
From(DateTime)
public static SaveNode From(DateTime value);
A node holding a date, always converted to UTC first so that a save made in one time zone reads correctly in another.
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: A string node holding a round-trip UTC date.
From(decimal)
public static SaveNode From(decimal value);
A node holding a decimal, with every digit kept.
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: A number node.
From(double)
public static SaveNode From(double value);
A node holding a double, written so it reads back bit-exact.
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: A number node.
From(float)
public static SaveNode From(float value);
A node holding a float, written so it reads back bit-exact.
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: A number node.
From(Guid)
public static SaveNode From(Guid value);
A node holding a GUID, in the plain hyphenated form.
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: A string node.
From(int)
public static SaveNode From(int value);
A node holding an int.
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: A number node.
From(long)
public static SaveNode From(long value);
A node holding a long, with every digit kept even past 2^53.
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: A number node.
From(Quaternion)
public static SaveNode From(Quaternion value);
A node holding a rotation, as [x, y, z, w].
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: An array node of four numbers.
From(Rect)
public static SaveNode From(Rect value);
A node holding a rectangle, as [x, y, width, height].
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: An array node of four numbers.
From(RectInt)
public static SaveNode From(RectInt value);
A node holding a whole-number rectangle, as [x, y, width, height].
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: An array node of four numbers.
From(sbyte)
public static SaveNode From(sbyte value);
A node holding a signed byte.
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: A number node.
From(short)
public static SaveNode From(short value);
A node holding a short.
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: A number node.
From(string)
public static SaveNode From(string value);
A node holding text. Null is stored as a null node, not as an empty string.
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: A string node, or a null node.
From(TimeSpan)
public static SaveNode From(TimeSpan value);
A node holding a length of time.
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: A string node holding a round-trip duration.
From(uint)
public static SaveNode From(uint value);
A node holding an unsigned int.
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: A number node.
From(ulong)
public static SaveNode From(ulong value);
A node holding an unsigned long, with every digit kept.
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: A number node.
From(ushort)
public static SaveNode From(ushort value);
A node holding an unsigned short.
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: A number node.
From(Vector2)
public static SaveNode From(Vector2 value);
A node holding a 2D vector, as [x, y].
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: An array node of two numbers.
From(Vector2Int)
public static SaveNode From(Vector2Int value);
A node holding a whole-number 2D vector, as [x, y].
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: An array node of two numbers.
From(Vector3)
public static SaveNode From(Vector3 value);
A node holding a 3D vector, as [x, y, z].
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: An array node of three numbers.
From(Vector3Int)
public static SaveNode From(Vector3Int value);
A node holding a whole-number 3D vector, as [x, y, z].
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: An array node of three numbers.
From(Vector4)
public static SaveNode From(Vector4 value);
A node holding a 4D vector, as [x, y, z, w].
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: An array node of four numbers.
FromEnum<TEnum>(TEnum)
public static SaveNode FromEnum<TEnum>(TEnum value) where TEnum : struct;
A node holding an enum value, stored by name. Storing the name rather than the number is what lets a developer reorder or insert enum values in a game update without breaking existing saves.
| Type parameter | Description |
|---|---|
TEnum |
The enum type. |
| Parameter | Description |
|---|---|
value |
The value to store. |
Returns: A string node holding the value name.
FromNode<T>(SaveNode, T)
public static T FromNode<T>(SaveNode node, T fallback);
Reads any supported value back out of a save tree node.
| Type parameter | Description |
|---|---|
T |
The value type. See "What can be saved" in the Reference for the supported list. |
| Parameter | Description |
|---|---|
node |
The node to read. Null returns the fallback. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
FromNodeOfType(SaveNode, Type, object)
public static object FromNodeOfType(SaveNode node, Type type, object fallback);
Reads a value of a known type back out of a save tree node.
| Parameter | Description |
|---|---|
node |
The node to read. Null returns the fallback. |
type |
The declared type to produce. Null returns the fallback. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
GetReader<T>()
public static Func<SaveNode, T, T> GetReader<T>();
The conversion function that reads a value of this type out of a node, given a fallback.
| Type parameter | Description |
|---|---|
T |
The value type. |
Returns: A function that never throws.
GetWriter<T>()
public static Func<T, SaveNode> GetWriter<T>();
The conversion function that turns a value of this type into a node. Held once per type, so a saver can cache it in a field and avoid the lookup entirely.
| Type parameter | Description |
|---|---|
T |
The value type. |
Returns: A function that never returns null.
IsBuiltInType(Type)
public static bool IsBuiltInType(Type type);
Whether a type is one Shipready converts directly, without going through the Unity serialiser. The Field Picker uses this to decide which Inspector fields it can offer.
| Parameter | Description |
|---|---|
type |
The type to test. Null returns false. |
Returns: true for a type with a built-in converter.
IsDictionaryType(Type, Type, Type)
public static bool IsDictionaryType(Type type, out Type keyType, out Type valueType);
Whether a type is a Dictionary<T, T2>, and if so its key and value types. Set, Get, Write and Read save one whose keys are String or Int32 and whose values are a supported type; any other is refused with a warning.
| Parameter | Description |
|---|---|
type |
The type to test. Null returns false. |
keyType |
The key type, or null. |
valueType |
The value type, or null. |
Returns: true for a closed Dictionary type.
IsGenericList(Type)
public static bool IsGenericList(Type type);
Whether a type is a List<T> of something.
| Parameter | Description |
|---|---|
type |
The type to test. Null returns false. |
Returns: true for a closed generic list.
IsSupportedType(Type)
public static bool IsSupportedType(Type type);
Whether Shipready can save a value of this type at all, counting lists, arrays and classes the Unity serialiser handles.
| Parameter | Description |
|---|---|
type |
The type to test. Null returns false. |
Returns: true when a value of this type can be saved.
IsUnitySerializableClass(Type)
public static bool IsUnitySerializableClass(Type type);
Whether the Unity serialiser can handle this type, which is the rule the Inspector itself follows.
| Parameter | Description |
|---|---|
type |
The type to test. Null returns false. |
Returns: true for a class or struct marked [Serializable].
ToBool(SaveNode, bool)
public static bool ToBool(SaveNode node, bool fallback);
Reads a bool, falling back when the node is missing or is another kind.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToBounds(SaveNode, Bounds)
public static Bounds ToBounds(SaveNode node, Bounds fallback);
Reads bounds, falling back when the node is missing or the wrong shape.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToBoundsInt(SaveNode, BoundsInt)
public static BoundsInt ToBoundsInt(SaveNode node, BoundsInt fallback);
Reads whole-number bounds, falling back when the node is the wrong shape.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToByte(SaveNode, byte)
public static byte ToByte(SaveNode node, byte fallback);
Reads a byte, falling back when the value is missing or out of range.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToBytes(SaveNode, byte[])
public static byte[] ToBytes(SaveNode node, byte[] fallback);
Reads raw bytes from base64 text, falling back when the value is missing.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored bytes, or the fallback.
ToChar(SaveNode, char)
public static char ToChar(SaveNode node, char fallback);
Reads one character, falling back when the node is missing or empty.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToColor(SaveNode, Color)
public static Color ToColor(SaveNode node, Color fallback);
Reads a colour, falling back when the node is missing or the wrong shape.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToColor32(SaveNode, Color32)
public static Color32 ToColor32(SaveNode node, Color32 fallback);
Reads a byte colour, falling back when the node is missing or the wrong shape.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToDateTime(SaveNode, DateTime)
public static DateTime ToDateTime(SaveNode node, DateTime fallback);
Reads a date. The result is always DateTimeKind.Utc; call ToLocalTime when showing it to a player.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value in UTC, or the fallback.
ToDecimal(SaveNode, decimal)
public static decimal ToDecimal(SaveNode node, decimal fallback);
Reads a decimal, falling back when the value is missing or out of range.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToDouble(SaveNode, double)
public static double ToDouble(SaveNode node, double fallback);
Reads a double, bit-exact for any value that was written by Shipready, including NaN and both infinities.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToEnum<TEnum>(SaveNode, TEnum)
public static TEnum ToEnum<TEnum>(SaveNode node, TEnum fallback) where TEnum : struct;
Reads an enum stored by name. A name that no longer exists, for example a value removed in a game update, falls back rather than failing the load.
| Type parameter | Description |
|---|---|
TEnum |
The enum type. |
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there or no longer exists. |
Returns: The stored value, or the fallback.
ToGuid(SaveNode, Guid)
public static Guid ToGuid(SaveNode node, Guid fallback);
Reads a GUID, falling back when the value is missing or malformed.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToInt16(SaveNode, short)
public static short ToInt16(SaveNode node, short fallback);
Reads a short, falling back when the value is missing or out of range.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToInt32(SaveNode, int)
public static int ToInt32(SaveNode node, int fallback);
Reads an int, falling back when the value is missing or out of range.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToInt64(SaveNode, long)
public static long ToInt64(SaveNode node, long fallback);
Reads a long, falling back when the value is missing or not a whole number.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToNode<T>(T)
public static SaveNode ToNode<T>(T value);
Turns any supported value into a save tree node.
| Type parameter | Description |
|---|---|
T |
The value type. See "What can be saved" in the Reference for the supported list. |
| Parameter | Description |
|---|---|
value |
The value to convert. |
Returns: The value as a tree node. Never null.
ToNodeOfType(object, Type)
public static SaveNode ToNodeOfType(object value, Type type);
Turns a value of a known type into a save tree node.
| Parameter | Description |
|---|---|
value |
The value to convert. Null becomes a null node. |
type |
The declared type of the value, which decides how it is stored. Null falls back to the runtime type of the value. |
Returns: The value as a tree node. Never null.
ToQuaternion(SaveNode, Quaternion)
public static Quaternion ToQuaternion(SaveNode node, Quaternion fallback);
Reads a rotation, falling back when the node is missing or the wrong shape.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToRect(SaveNode, Rect)
public static Rect ToRect(SaveNode node, Rect fallback);
Reads a rectangle, falling back when the node is missing or the wrong shape.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToRectInt(SaveNode, RectInt)
public static RectInt ToRectInt(SaveNode node, RectInt fallback);
Reads a whole-number rectangle, falling back when the node is the wrong shape.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToSByte(SaveNode, sbyte)
public static sbyte ToSByte(SaveNode node, sbyte fallback);
Reads a signed byte, falling back when the value is missing or out of range.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToSingle(SaveNode, float)
public static float ToSingle(SaveNode node, float fallback);
Reads a float, bit-exact for any value that was written by Shipready, including NaN and both infinities.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToText(SaveNode, string)
public static string ToText(SaveNode node, string fallback);
Reads text, falling back when the node is missing or holds no value.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToTimeSpan(SaveNode, TimeSpan)
public static TimeSpan ToTimeSpan(SaveNode node, TimeSpan fallback);
Reads a length of time, falling back when the value is missing.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToUInt16(SaveNode, ushort)
public static ushort ToUInt16(SaveNode node, ushort fallback);
Reads an unsigned short, falling back when the value is missing or out of range.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToUInt32(SaveNode, uint)
public static uint ToUInt32(SaveNode node, uint fallback);
Reads an unsigned int, falling back when the value is missing or out of range.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToUInt64(SaveNode, ulong)
public static ulong ToUInt64(SaveNode node, ulong fallback);
Reads an unsigned long, falling back when the value is missing or negative.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToUtc(DateTime)
public static DateTime ToUtc(DateTime value);
Converts a date to UTC. An unspecified kind is treated as local time, because that is what DateTime.Now and an Inspector field both produce.
| Parameter | Description |
|---|---|
value |
The date to convert. |
Returns: The same moment in UTC.
ToVector2(SaveNode, Vector2)
public static Vector2 ToVector2(SaveNode node, Vector2 fallback);
Reads a 2D vector, falling back when the node is missing or the wrong shape.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToVector2Int(SaveNode, Vector2Int)
public static Vector2Int ToVector2Int(SaveNode node, Vector2Int fallback);
Reads a whole-number 2D vector, falling back when the node is the wrong shape.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToVector3(SaveNode, Vector3)
public static Vector3 ToVector3(SaveNode node, Vector3 fallback);
Reads a 3D vector, falling back when the node is missing or the wrong shape.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToVector3Int(SaveNode, Vector3Int)
public static Vector3Int ToVector3Int(SaveNode node, Vector3Int fallback);
Reads a whole-number 3D vector, falling back when the node is the wrong shape.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
ToVector4(SaveNode, Vector4)
public static Vector4 ToVector4(SaveNode node, Vector4 fallback);
Reads a 4D vector, falling back when the node is missing or the wrong shape.
| Parameter | Description |
|---|---|
node |
The node to read. May be null. |
fallback |
What to return when the value is not there. |
Returns: The stored value, or the fallback.
TryParseDoubleText(string, double)
public static bool TryParseDoubleText(string text, out double value);
Parses number text the way Shipready writes it, which is always invariant. Exposed because the Save Inspector and Diagnostics both need it.
| Parameter | Description |
|---|---|
text |
The text to parse. |
value |
The parsed value, or zero when parsing failed. |
Returns: true when the text was a number.
Namespace RareGeometry.Shipready.Save.Diagnostics #
PlayModeToast #
class in RareGeometry.Shipready.Save.Diagnostics · assembly RareGeometry.Shipready.Save
public sealed class PlayModeToast : MonoBehaviour
The Editor's Play Mode toast: a short note at the top of the Game view after each save or load, such as "Saved Slot 1: 12 objects, 3 values". Clicking it raises Clicked, which Shipready's editor tools answer by opening the Save Inspector on that report. Shipready's editor code adds it at the start of Play Mode when the toasts are switched on (Tools → Shipready → Saves → Play Mode Toasts). Editor only: this class does not exist in builds, so nothing of it can reach a player.
Properties
CurrentText
public string CurrentText { get; }
The text on show now, or an empty string. Read by tests.
Methods
Show(SaveEventInfo)
public void Show(SaveEventInfo info);
Shows the toast for a finished save or load.
| Parameter | Description |
|---|---|
info |
The event Shipready raised. |
Events
Clicked
public static event Action<SaveEventInfo> Clicked;
Raised on the main thread when the toast is clicked, with the event it describes. Set by Shipready's editor tools; cleared when the toast object is destroyed at the end of Play Mode.
SaveFileCopy #
enum in RareGeometry.Shipready.Save.Diagnostics · assembly RareGeometry.Shipready.Save
public enum SaveFileCopy
Which copy of a save file was read.
Values
SaveLog #
static class in RareGeometry.Shipready.Save.Diagnostics · assembly RareGeometry.Shipready.Save
public static class SaveLog
The one place Shipready writes to the Console. Every line carries the product prefix and, where there is one, the SK identifier, so a developer can search for it.
Properties
Level
public static SaveLogLevel Level { get; set; }
How much is written to the Console. Defaults to SaveLogLevel.Warnings.
RecentReports
public static IReadOnlyList<SaveReport> RecentReports { get; }
The reports of the most recent saves and loads of this play session, oldest first, at most RecentReportCapacity. Every finished save and load is kept whatever the log level, so the Save Inspector can list them even while the Console stays quiet. The list is a snapshot that never changes after it is handed out.
ReportToConsole
public static bool ReportToConsole { get; set; }
Whether every save and load prints a one-line report (SaveReport.ToSummaryLine(SaveErrorCode, bool)) to the Console at SaveLogLevel.Warnings and above. Off by default, so the Console stays quiet; Shipready copies SaveKitSettings.ReportToConsole here when it starts. At SaveLogLevel.Verbose the line is always printed, with the time of each stage added. At SaveLogLevel.Errors and SaveLogLevel.Off nothing is printed.
Constants
RecentReportCapacity
public const int RecentReportCapacity = 20;
How many finished reports RecentReports keeps, newest last.
Methods
ClearRecentReports()
public static void ClearRecentReports();
Forgets every report in RecentReports.
Describe(SaveErrorCode, string)
public static string Describe(SaveErrorCode code, string detail);
Builds the one-line description used for a code: identifier, message, detail and the place in the documentation that explains it.
| Parameter | Description |
|---|---|
code |
The code to describe. |
detail |
Extra detail. May be null or empty. |
Returns: A single line. Never null.
Error(SaveErrorCode, string)
public static void Error(SaveErrorCode code, string detail);
Writes a failure line for a code, including its SK identifier and documentation link.
| Parameter | Description |
|---|---|
code |
The code to report. |
detail |
Extra detail, such as a file name. May be null. |
Error(string)
public static void Error(string message);
Writes a failure line, at SaveLogLevel.Errors and above.
| Parameter | Description |
|---|---|
message |
The line to write. |
Info(string)
public static void Info(string message);
Writes an informational line, only at SaveLogLevel.Verbose.
| Parameter | Description |
|---|---|
message |
The line to write. |
Report(SaveReport)
public static void Report(SaveReport report);
Writes a finished report. Warnings go out at SaveLogLevel.Warnings. A report of a save or a load of a file also prints its one-line summary at SaveLogLevel.Warnings when ReportToConsole is on, and always at SaveLogLevel.Verbose, where the summary adds the time of each stage. At every level, including SaveLogLevel.Off, the report also joins RecentReports and raises ReportAdded.
| Parameter | Description |
|---|---|
report |
The report to write. Null is ignored. |
Report(SaveReport, SaveErrorCode)
public static void Report(SaveReport report, SaveErrorCode outcome);
Writes a finished report as Report(SaveReport) does, with the outcome of the call, so a failed save or load says so on its summary line.
| Parameter | Description |
|---|---|
report |
The report to write. Null is ignored. |
outcome |
The code the call finished with. SaveErrorCode.None for a success. |
ResetToDefaults()
public static void ResetToDefaults();
Puts the log level and ReportToConsole back to their defaults. Called when static state is reset, so that turning off domain reload cannot leave a stale level behind.
Warning(SaveErrorCode, string)
public static void Warning(SaveErrorCode code, string detail);
Writes a warning line for a code, including its SK identifier and documentation link.
| Parameter | Description |
|---|---|
code |
The code to report. |
detail |
Extra detail, such as a file name. May be null. |
Warning(string)
public static void Warning(string message);
Writes a warning line, at SaveLogLevel.Warnings and above.
| Parameter | Description |
|---|---|
message |
The line to write. |
Events
ReportAdded
public static event Action<SaveReport> ReportAdded;
Raised each time a finished save or load report joins RecentReports, on the thread that finished the operation (the main thread for every SaveKit call). A handler that throws is reported in the Console and never reaches the save. Handlers are dropped when a new play session resets Shipready's static state.
SaveLogLevel #
enum in RareGeometry.Shipready.Save.Diagnostics · assembly RareGeometry.Shipready.Save
public enum SaveLogLevel
How much Shipready writes to the Console.
Values
| Name | Value | Description |
|---|---|---|
Off |
0 |
Nothing at all. |
Errors |
1 |
Only failures. |
Warnings |
2 |
Failures and warnings, plus a one-line report of every save and load while SaveLog.ReportToConsole is on. This is the default. |
Verbose |
3 |
Everything, including a report with stage timings for every save and load. |
SaveOperation #
enum in RareGeometry.Shipready.Save.Diagnostics · assembly RareGeometry.Shipready.Save
public enum SaveOperation
Which operation a report describes.
Values
SavePacking #
enum in RareGeometry.Shipready.Save.Diagnostics · assembly RareGeometry.Shipready.Save
public enum SavePacking
How the data section of a file is packed.
Values
SaveProfilerMarkers #
static class in RareGeometry.Shipready.Save.Diagnostics · assembly RareGeometry.Shipready.Save
public static class SaveProfilerMarkers
The names of the Profiler markers Shipready wraps around each stage of a save and a load, so every stage shows up in Unity's Profiler, on the thread it ran on. Capture and Restore run on the main thread; the others run on the background thread a save or load uses.
A save: Capture (gathering the values), Serialize (the tree to JSON), Compress, Encrypt, Write (every disk write, swap, backup move and delete) and Verify (reading the temporary file back and checking it, after the temporary file is written and before it is swapped into place). Verify sits beside the Write samples, not inside them, and its own disk read shows as a Read inside it. A load: Read (every disk read), Decrypt, Decompress, Parse (JSON to the tree and the checksum check), Migrate and Restore (putting the values back into the game).
The markers cost next to nothing while the Profiler is not recording. A game can read them with ProfilerRecorder or Recorder.Get by these names.
Constants
Capture
public const string Capture = "Shipready.Save.Capture";
Gathering the values and the world on the main thread before a save.
Compress
public const string Compress = "Shipready.Save.Compress";
GZip compressing the data section.
Decompress
public const string Decompress = "Shipready.Save.Decompress";
Unpacking GZip compressed data.
Decrypt
public const string Decrypt = "Shipready.Save.Decrypt";
Checking the signature and decrypting the data section.
Encrypt
public const string Encrypt = "Shipready.Save.Encrypt";
Encrypting the data section and signing the file.
Migrate
public const string Migrate = "Shipready.Save.Migrate";
Running migration steps on an old save.
Parse
public const string Parse = "Shipready.Save.Parse";
Turning JSON text into the save tree and checking its checksum.
Read
public const string Read = "Shipready.Save.Read";
Reading from the disk.
Restore
public const string Restore = "Shipready.Save.Restore";
Putting loaded values back into the game and the world on the main thread.
Serialize
public const string Serialize = "Shipready.Save.Serialize";
Turning the save tree into JSON text.
Verify
public const string Verify = "Shipready.Save.Verify";
Reading the temporary file back and checking it before it is swapped into place.
Write
public const string Write = "Shipready.Save.Write";
Writing to the disk: the temporary file, the swap, the backups, thumbnails and the slot cache.
SaveReport #
class in RareGeometry.Shipready.Save.Diagnostics · assembly RareGeometry.Shipready.Save
public sealed class SaveReport
What one save or load actually did: how long each stage took, how much was written and anything worth a warning. Every public call returns one, and the Save Inspector and the Console both print it.
Properties
CaptureMilliseconds
public double CaptureMilliseconds { get; }
Milliseconds spent capturing game state on the main thread.
CategoryCount
public int CategoryCount { get; }
How many categories took part.
CompressMilliseconds
public double CompressMilliseconds { get; }
Milliseconds spent compressing or decompressing.
DestroyedCount
public int DestroyedCount { get; }
How many objects a load destroyed or switched off because they were destroyed during play.
EncryptMilliseconds
public double EncryptMilliseconds { get; }
Milliseconds spent encrypting or decrypting.
FileBytes
public long FileBytes { get; }
How many bytes the finished file holds.
FileName
public string FileName { get; }
The file this report is about, as a storage-relative name.
HasWarnings
public bool HasWarnings { get; }
Whether anything was flagged.
LoadedFrom
public SaveFileCopy LoadedFrom { get; }
Which copy of the file the data came from.
MigrationsRun
public int[] MigrationsRun { get; }
Which migration steps ran, lowest version first. Empty when none were needed.
ObjectCount
public int ObjectCount { get; }
How many scene objects had their state captured or restored.
Operation
public SaveOperation Operation { get; }
Which operation this report describes.
Packing
public SavePacking Packing { get; }
How the file was packed: readable, compressed, encrypted or both.
ReportedUtc
public DateTime ReportedUtc { get; }
When the report was recorded (UTC), so tools can show the time of each save and load. Default until recorded.
RestoredCount
public int RestoredCount { get; }
How many saved objects had their state applied by a load: scene objects, re-created runtime objects and their saved children.
RestoreMilliseconds
public double RestoreMilliseconds { get; }
Milliseconds spent restoring game state on the main thread.
SerializeMilliseconds
public double SerializeMilliseconds { get; }
Milliseconds spent turning the save tree into bytes, or bytes back into a tree.
SkippedCount
public int SkippedCount { get; }
How many saved objects no longer exist and were skipped.
SkippedObjects
public IReadOnlyList<string> SkippedObjects { get; }
The saved objects a load skipped because they no longer exist, each as name (id). Empty when nothing was skipped.
SpawnedCount
public int SpawnedCount { get; }
How many runtime objects a save wrote, or a load re-created.
StorageMilliseconds
public double StorageMilliseconds { get; }
Milliseconds spent reading from or writing to storage, including verification.
TotalMilliseconds
public double TotalMilliseconds { get; }
Milliseconds from the first line of the call to the last.
UnpackedBytes
public long UnpackedBytes { get; }
How many bytes the data section took before compression and encryption.
ValueCount
public int ValueCount { get; }
How many values were written or read.
Warnings
public IReadOnlyList<SaveWarning> Warnings { get; }
Everything the operation wants to flag without failing.
Methods
AddWarning(SaveErrorCode, string)
public void AddWarning(SaveErrorCode code, string detail);
Adds a warning. Used by Shipready while it works; games read warnings rather than add them.
| Parameter | Description |
|---|---|
code |
The code that classifies the warning. |
detail |
What specifically happened, such as an object name. |
Reset()
public void Reset();
Empties the report so it can be used again, which avoids an allocation per save.
ToString()
public override string ToString();
A one-paragraph summary for the Console, the Save Inspector and support emails.
Returns: A human-readable summary. Never null.
ToSummaryLine(SaveErrorCode, bool)
public string ToSummaryLine(SaveErrorCode outcome, bool withStageTimings);
The one line the Console shows for a save or a load: what it was, the file, how long it took (capture, file work and restore together), the counts, the file size and how many warnings it had, for example Save slot_01.save: 12.4 ms, 5 categories, 214 values, 40 objects, 5321 bytes, 0 warnings.
| Parameter | Description |
|---|---|
outcome |
The code the call finished with. Anything that is not a success is named on the line. |
withStageTimings |
Whether to add the time of each stage, as the Verbose log level does. |
Returns: A single line. Never null.
SaveToastText #
static class in RareGeometry.Shipready.Save.Diagnostics · assembly RareGeometry.Shipready.Save
public static class SaveToastText
The one-line text of the Editor's Play Mode toast after a save or a load, for example "Saved Slot 1: 12 objects, 3 values" or "Loaded Slot 1: 11 restored, 1 skipped, Chest_02 not found (SK130). Click for details". Editor only: it does not exist in builds.
Methods
Format(SaveEventInfo)
public static string Format(SaveEventInfo info);
Builds the toast text for a finished save or load.
| Parameter | Description |
|---|---|
info |
The event Shipready raised when the operation finished. |
Returns: The text, or an empty string for operations that get no toast. Never null.
Format(SaveOperation, int, string, SaveErrorCode, SaveFileCopy, SaveReport)
public static string Format(SaveOperation operation, int slot, string fileName, SaveErrorCode code, SaveFileCopy loadedFrom, SaveReport report);
Builds the toast text from the parts of a finished save or load.
| Parameter | Description |
|---|---|
operation |
Save or Load; anything else gets no toast. |
slot |
The slot number, or zero for a file that is not a numbered slot. |
fileName |
The storage-relative file name, used when slot is zero. |
code |
The code the operation finished with. |
loadedFrom |
Which copy of the file a load read. |
report |
The operation's report, or null. |
Returns: The text, or an empty string for operations that get no toast. Never null.
Label(int, string)
public static string Label(int slot, string fileName);
How the toast names a file: "Slot 3" for a numbered slot, otherwise the file name without its extension.
| Parameter | Description |
|---|---|
slot |
The slot number, or zero. |
fileName |
The storage-relative file name. |
Returns: The name. Empty when neither is known.
SaveWarning #
struct in RareGeometry.Shipready.Save.Diagnostics · assembly RareGeometry.Shipready.Save
public struct SaveWarning
One thing a save or load wants to flag without failing the call.
Constructors
SaveWarning(SaveErrorCode, string)
public SaveWarning(SaveErrorCode code, string detail);
Creates a warning.
| Parameter | Description |
|---|---|
code |
The code that classifies it. |
detail |
What specifically happened. |
Fields
Code
public readonly SaveErrorCode Code;
The code that classifies this warning.
Detail
public readonly string Detail;
What specifically happened, such as the name of a missing object.
Methods
ToString()
public override string ToString();
The warning as one line, starting with its SK identifier.
Returns: A human-readable line. Never null.
Namespace RareGeometry.Shipready.Save.Files #
AtomicFileWriter #
static class in RareGeometry.Shipready.Save.Files · assembly RareGeometry.Shipready.Save
public static class AtomicFileWriter
Writes a save file so that a crash can never leave a player without one.
The promise is that at every moment during a save, at least one complete, valid copy exists on disk. The new bytes go to a temporary file first and are read back and checked against what Shipready meant to write. Only then is the temporary file swapped into place in a single step, with the file it replaces parked under a staging name. The backups are shuffled down afterwards, never before, so a save that fails at the swap has destroyed nothing. Cut the power at any point and the next load finds either the new save or the previous one, never half of either.
Methods
Write(ISaveStorage, string, byte[], int)
public static AtomicWriteOutcome Write(ISaveStorage storage, string mainName, byte[] bytes, int backupCount);
Writes a save file and swaps it into place.
| Parameter | Description |
|---|---|
storage |
Where the files live. |
mainName |
The main file name, for example slot_01.save. |
bytes |
The finished file contents. |
backupCount |
How many rotating backups to keep, from 0 to 5. |
Returns: What happened, including which step it reached.
AtomicWriteOutcome #
struct in RareGeometry.Shipready.Save.Files · assembly RareGeometry.Shipready.Save
public struct AtomicWriteOutcome
What writing a save file did.
Fields
BackupCount
public int BackupCount;
How many backups exist afterwards.
Code
public SaveErrorCode Code;
Why it failed, or SaveErrorCode.None.
Error
public string Error;
A plain-English reason, or null on success.
FileBytes
public long FileBytes;
How many bytes the finished file holds.
Step
public AtomicWriteStep Step;
Which step of the write it reached, for the report and for support.
Success
public bool Success;
Whether the new save is now in place.
Warning
public StorageOutcome? Warning;
Something that went wrong while tidying the backups, after the new save was already safely in place. The save still succeeded; this is reported as a warning.
AtomicWriteStep #
enum in RareGeometry.Shipready.Save.Files · assembly RareGeometry.Shipready.Save
public enum AtomicWriteStep
The steps of a crash-safe write, in the order they run.
Values
BackupRotator #
static class in RareGeometry.Shipready.Save.Files · assembly RareGeometry.Shipready.Save
public static class BackupRotator
Keeps the rotating backups for one save file. Two are kept by default, which is one more copy than almost any player needs and still costs nothing worth measuring.
Rotation happens just before a new save is swapped into place: the oldest backup is dropped, the rest shuffle down a number, and the file being replaced becomes the newest backup. At no point is more than one copy in motion, so a crash during rotation still leaves a complete save on disk.
Constants
MaximumBackups
public const int MaximumBackups = 5;
The largest number of backups Shipready will keep.
Methods
CountBackups(ISaveStorage, string)
public static int CountBackups(ISaveStorage storage, string mainName);
How many backups of a file currently exist.
| Parameter | Description |
|---|---|
storage |
Where the files live. |
mainName |
The main file name. |
Returns: A count from 0 to MaximumBackups.
DeleteAll(ISaveStorage, string)
public static StorageOutcome DeleteAll(ISaveStorage storage, string mainName);
Removes every backup of a file, used when a player deletes a save.
| Parameter | Description |
|---|---|
storage |
Where the files live. |
mainName |
The main file name. |
Returns: What happened.
Prune(ISaveStorage, string, int)
public static StorageOutcome Prune(ISaveStorage storage, string mainName, int backupCount);
Removes every backup past the configured count, which is what keeps the count honest after a developer lowers the setting in a game update.
| Parameter | Description |
|---|---|
storage |
Where the files live. |
mainName |
The main file name. |
backupCount |
How many backups to keep, from 0 to 5. |
Returns: What happened.
Rotate(ISaveStorage, string, int)
public static StorageOutcome Rotate(ISaveStorage storage, string mainName, int backupCount);
Moves every existing backup down one number, dropping any that fall past the limit, leaving the newest backup slot free.
This runs only after a new save is safely in place. Rotating first, as an earlier version of Shipready did, meant that a save which then failed at the swap had already thrown a backup away: two failed saves in a row left a player with a stale main file and no backups at all.
| Parameter | Description |
|---|---|
storage |
Where the files live. |
mainName |
The main file name. |
backupCount |
How many backups to keep, from 0 to 5. |
Returns: What happened. Dropping a backup that is not there is not a failure.
Checksum #
static class in RareGeometry.Shipready.Save.Files · assembly RareGeometry.Shipready.Save
public static class Checksum
The checksum written into every save header and verified on every load. CRC-32 is enough to spot a truncated, half-written or hand-edited file, which is the job here; encrypted files get a cryptographic tamper check on top of it.
Constants
Crc32Prefix
public const string Crc32Prefix = "crc32:";
The prefix every checksum string carries, so other kinds can be added later.
Methods
Crc32(byte[])
public static uint Crc32(byte[] data);
The CRC-32 of a whole byte array.
| Parameter | Description |
|---|---|
data |
The bytes to sum. Null is treated as empty. |
Returns: The checksum.
Crc32(byte[], int, int)
public static uint Crc32(byte[] data, int offset, int count);
The CRC-32 of a byte range, using the standard reflected polynomial 0xEDB88320.
| Parameter | Description |
|---|---|
data |
The bytes to sum. Null is treated as empty. |
offset |
Where to start. |
count |
How many bytes to include. |
Returns: The checksum.
Crc32Utf8(string)
public static uint Crc32Utf8(string text);
The CRC-32 of a string, measured over its UTF-8 bytes with no byte order mark.
| Parameter | Description |
|---|---|
text |
The text to sum. Null is treated as empty. |
Returns: The checksum.
Format(uint)
public static string Format(uint crc);
Formats a checksum the way the save header stores it, for example crc32:5F1A9C02. Always uppercase hexadecimal and always invariant.
| Parameter | Description |
|---|---|
crc |
The checksum to format. |
Returns: The header form of the checksum.
Matches(string, byte[], int, int)
public static bool Matches(string text, byte[] data, int offset, int count);
Whether a header checksum string matches a byte range.
| Parameter | Description |
|---|---|
text |
The header form of the expected checksum. |
data |
The bytes to check. |
offset |
Where to start. |
count |
How many bytes to include. |
Returns: true when the text parses and the sums match.
TryParse(string, uint)
public static bool TryParse(string text, out uint crc);
Reads a checksum back out of a header string.
| Parameter | Description |
|---|---|
text |
The header form, for example crc32:5F1A9C02. |
crc |
The parsed checksum, or zero when parsing failed. |
Returns: true when the text was a checksum Shipready version understands.
EnvelopeReadOutcome #
struct in RareGeometry.Shipready.Save.Files · assembly RareGeometry.Shipready.Save
public struct EnvelopeReadOutcome
What reading an envelope produced.
Fields
ChecksumMismatchAccepted
public bool ChecksumMismatchAccepted;
Whether the checksum did not match but the file was accepted anyway, because the settings allow hand-edited saves or because this is the Editor.
Code
public SaveErrorCode Code;
Why it failed, or SaveErrorCode.None.
CompressMilliseconds
public double CompressMilliseconds;
Milliseconds spent decompressing.
EncryptMilliseconds
public double EncryptMilliseconds;
Milliseconds spent decrypting.
Error
public string Error;
A plain-English reason, or null on success.
Header
public SaveHeader Header;
The header, which is set whenever the front of the file was readable, even if the data section later turned out to be damaged.
Info
public SaveNode Info;
The slot info, set whenever it was readable without unpacking the data.
SerializeMilliseconds
public double SerializeMilliseconds;
Milliseconds spent turning text into a tree.
Success
public bool Success;
Whether the save was read.
Tree
public SaveTree Tree;
The save, or null when reading failed.
UnpackedBytes
public long UnpackedBytes;
How many bytes the data section took once unpacked.
EnvelopeWriteOutcome #
struct in RareGeometry.Shipready.Save.Files · assembly RareGeometry.Shipready.Save
public struct EnvelopeWriteOutcome
What writing an envelope produced.
Fields
Bytes
public byte[] Bytes;
The finished file contents.
Code
public SaveErrorCode Code;
Why it failed, or SaveErrorCode.None.
CompressMilliseconds
public double CompressMilliseconds;
Milliseconds spent compressing.
EncryptMilliseconds
public double EncryptMilliseconds;
Milliseconds spent encrypting.
Error
public string Error;
A plain-English reason, or null on success.
Packing
public SavePacking Packing;
How the data section ended up packed.
SerializeMilliseconds
public double SerializeMilliseconds;
Milliseconds spent turning the tree into text.
Success
public bool Success;
Whether the bytes were produced.
UnpackedBytes
public long UnpackedBytes;
How many bytes the data section took before packing.
RecoveryAttempt #
struct in RareGeometry.Shipready.Save.Files · assembly RareGeometry.Shipready.Save
public struct RecoveryAttempt
One copy of a save that the recovery loader tried, and how it went.
Constructors
RecoveryAttempt(string, SaveFileCopy, SaveErrorCode, string)
public RecoveryAttempt(string fileName, SaveFileCopy copy, SaveErrorCode code, string error);
Records one attempt.
| Parameter | Description |
|---|---|
fileName |
The file name that was tried. |
copy |
Which copy of the save it was. |
code |
What was wrong with it. |
error |
A plain-English reason. |
Properties
Succeeded
public bool Succeeded { get; }
Whether this attempt is the one that worked.
Fields
Code
public readonly SaveErrorCode Code;
What was wrong with it, or SaveErrorCode.None when this is the copy that was used.
Copy
public readonly SaveFileCopy Copy;
Which copy of the save it was.
Error
public readonly string Error;
A plain-English reason, or null when nothing was wrong.
FileName
public readonly string FileName;
The file name that was tried.
Methods
ToString()
public override string ToString();
The attempt as one line for a report.
Returns: A human-readable line. Never null.
RecoveryLoader #
static class in RareGeometry.Shipready.Save.Files · assembly RareGeometry.Shipready.Save
public static class RecoveryLoader
Reads a save, falling back through every copy Shipready keeps until one works.
The order is the main file, then a complete temporary file left behind by a save that was cut short, then each backup from newest to oldest. The first valid copy wins, and the result says which one it was, so the menu can show "Restored from backup" and the game can tell the player what happened.
A damaged main file is moved aside rather than deleted, because a player who has lost progress deserves to have somebody able to look at the file. When every copy is damaged, nothing at all is touched.
Methods
Load(ISaveStorage, string, SaveFileOptions, bool, bool)
public static RecoveryOutcome Load(ISaveStorage storage, string mainName, SaveFileOptions options, bool acceptEditedFiles, bool quarantineDamagedMain);
Reads a save, trying each copy in turn.
When SaveFileOptions.AutomaticFallback is off, only the main file is read: a damaged or missing main file fails with the damage code and nothing is moved aside, so the player can choose to restore a backup instead.
| Parameter | Description |
|---|---|
storage |
Where the files live. |
mainName |
The main file name. |
options |
The file options to read with. Null uses the defaults. |
acceptEditedFiles |
Whether a file whose checksum no longer matches should be loaded anyway. The Editor passes true so a developer can edit a save while testing. |
quarantineDamagedMain |
Whether to move a damaged main file aside once a backup has loaded successfully. |
Returns: What happened, including the save on success.
Load(ISaveStorage, string, SaveFileOptions, bool, bool, bool)
public static RecoveryOutcome Load(ISaveStorage storage, string mainName, SaveFileOptions options, bool acceptEditedFiles, bool quarantineDamagedMain, bool allowFallback);
Reads a save, trying each copy in turn only when falling back is allowed.
| Parameter | Description |
|---|---|
storage |
Where the files live. |
mainName |
The main file name. |
options |
The file options to read with. Null uses the defaults. |
acceptEditedFiles |
Whether a file whose checksum no longer matches should be loaded anyway. |
quarantineDamagedMain |
Whether to move a damaged main file aside once a backup has loaded successfully. |
allowFallback |
Whether the temporary file and the backups may be tried when the main file is damaged or missing. The slot info passes true whatever the settings say, because the menu needs to know whether a valid backup exists to offer Restore backup. |
Returns: What happened, including the save on success.
Quarantine(ISaveStorage, string)
public static string Quarantine(ISaveStorage storage, string name);
Moves a damaged file aside, keeping it for support rather than deleting it.
| Parameter | Description |
|---|---|
storage |
Where the files live. |
name |
The file to move aside. |
Returns: The name it was moved to, or null when it could not be moved.
Verify(ISaveStorage, string, SaveFileOptions)
public static RecoveryOutcome Verify(ISaveStorage storage, string mainName, SaveFileOptions options);
Checks a save without using its contents, which is what the Save Inspector and the menu need to put a status badge on a slot.
| Parameter | Description |
|---|---|
storage |
Where the files live. |
mainName |
The main file name. |
options |
The file options to read with. Null uses the defaults. |
Returns: What happened. The tree is left null.
RecoveryOutcome #
struct in RareGeometry.Shipready.Save.Files · assembly RareGeometry.Shipready.Save
public struct RecoveryOutcome
What reading a save, with recovery, produced.
Fields
Attempts
public List<RecoveryAttempt> Attempts;
One entry per copy that was tried and what was wrong with it, which is what a support email needs and what the Save Inspector shows.
ChecksumMismatchAccepted
public bool ChecksumMismatchAccepted;
Whether the checksum did not match but the file was accepted anyway.
Code
public SaveErrorCode Code;
Why it failed, or the code that describes how it succeeded.
CompressMilliseconds
public double CompressMilliseconds;
Milliseconds spent decompressing.
EncryptMilliseconds
public double EncryptMilliseconds;
Milliseconds spent decrypting.
Error
public string Error;
A plain-English reason, or null on a plain success.
FileBytes
public long FileBytes;
How many bytes the file that was read holds.
Header
public SaveHeader Header;
The header of the copy that was read, when one was readable.
Info
public SaveNode Info;
The slot info of the copy that was read, when one was readable.
LoadedFileName
public string LoadedFileName;
The name of the file the data came from.
LoadedFrom
public SaveFileCopy LoadedFrom;
Which copy the data came from.
QuarantinedAs
public string QuarantinedAs;
Where a damaged main file was moved aside to, or null when nothing was quarantined.
SerializeMilliseconds
public double SerializeMilliseconds;
Milliseconds spent turning text into a tree.
StorageMilliseconds
public double StorageMilliseconds;
Milliseconds spent reading bytes from storage.
Success
public bool Success;
Whether the game got a save back.
Tree
public SaveTree Tree;
The save, or null when every copy was unusable.
UnpackedBytes
public long UnpackedBytes;
How many bytes the data section took once unpacked.
SaveEnvelope #
static class in RareGeometry.Shipready.Save.Files · assembly RareGeometry.Shipready.Save
public static class SaveEnvelope
The file format. A readable save is plain JSON that any text editor opens. A compressed or encrypted save is a short binary marker, then a readable header, then the packed data, so the menu can still read slot info without unpacking anything.
The loader tells the two apart from the first bytes, which is what lets a game turn compression or encryption on in an update without stranding the saves players already have.
Constants and fields
Marker
public static readonly byte[] Marker;
The marker every packed save starts with.
MinimumPackedLength
public const int MinimumPackedLength = 7 + 4 + 4;
A packed file can never be smaller than the marker and two lengths.
Methods
HasMarker(byte[])
public static bool HasMarker(byte[] bytes);
Whether bytes start with the packed-save marker.
| Parameter | Description |
|---|---|
bytes |
The bytes to look at. Null returns false. |
Returns: true when the marker is present.
Read(byte[], SaveFileOptions, bool)
public static EnvelopeReadOutcome Read(byte[] bytes, SaveFileOptions options, bool acceptEditedFiles);
Reads a save back out of bytes, in either envelope form.
| Parameter | Description |
|---|---|
bytes |
The file contents. |
options |
The file options to read with. Null uses the defaults. |
acceptEditedFiles |
Whether a file whose checksum no longer matches should be loaded anyway. The Editor always passes true, so a developer can edit a save while testing. |
Returns: What happened, including the save on success.
ReadHeaderOnly(byte[], SaveFileOptions, bool)
public static EnvelopeReadOutcome ReadHeaderOnly(byte[] bytes, SaveFileOptions options, bool acceptEditedFiles);
Reads only the header and the slot info, without unpacking the game data. The menu uses this to list slots quickly, even for encrypted saves.
| Parameter | Description |
|---|---|
bytes |
The file contents. |
options |
The file options to read with. Null uses the defaults. |
acceptEditedFiles |
Whether a file whose checksum no longer matches should be accepted. The menu passes the same answer a load would use, so a slot cannot look healthy in the list and then refuse to load. |
Returns: What happened. On success the header and info are set and the tree is null, except for a file that keeps its slot info inside the packed data, where the whole file has to be unpacked anyway.
Write(SaveTree, SaveFileOptions)
public static EnvelopeWriteOutcome Write(SaveTree tree, SaveFileOptions options);
Turns a save into the bytes that go on disk.
| Parameter | Description |
|---|---|
tree |
The save to write. Null fails. |
options |
The file options to write it with. Null uses the defaults. |
Returns: What happened, including the bytes on success.
SaveFileNames #
static class in RareGeometry.Shipready.Save.Files · assembly RareGeometry.Shipready.Save
public static class SaveFileNames
The naming rules for everything Shipready writes. They exist so that one Steam Auto-Cloud pattern of *.save uploads the real saves and nothing else: backups, temporary files and quarantined copies all end in something different, so they stay on the machine where they are useful and out of a player cloud quota where they are not.
Constants
BackupSuffix
public const string BackupSuffix = ".bak";
The suffix backups carry, followed by the backup number.
CorruptSuffix
public const string CorruptSuffix = ".corrupt-";
The suffix a damaged file is renamed with, followed by the time it happened.
CorruptTimeFormat
public const string CorruptTimeFormat = "yyyyMMdd-HHmmss-fff";
The time format used in the name of a quarantined file.
TemporarySuffix
public const string TemporarySuffix = ".tmp";
The suffix a half-written save carries until it is proven good.
Methods
Backup(string, int)
public static string Backup(string mainName, int index);
The name of a backup.
| Parameter | Description |
|---|---|
mainName |
The main file name. |
index |
Which backup, counting from 1 for the newest. |
Returns: The backup file name.
Corrupt(string, DateTime)
public static string Corrupt(string mainName, DateTime whenUtc);
The name a damaged file is moved aside to. The time is in the name, so several damaged copies can sit side by side and a support email can say which is which.
| Parameter | Description |
|---|---|
mainName |
The main file name. |
whenUtc |
When the damage was noticed. |
Returns: The quarantined file name.
IsBackup(string)
public static bool IsBackup(string name);
Whether a name is one of the rotating backups.
| Parameter | Description |
|---|---|
name |
The file name to test. |
Returns: true when the name ends in a backup suffix and a number.
IsWorkingCopy(string)
public static bool IsWorkingCopy(string name);
Whether a name belongs to Shipready but is not a save a player would load: a temporary file, a backup or a quarantined copy.
| Parameter | Description |
|---|---|
name |
The file name to test. |
Returns: true when the file is one of Shipready own working copies.
MainFileOf(string)
public static string MainFileOf(string name);
The main file a working copy belongs to, so the Save Inspector can group a save and its backups together.
| Parameter | Description |
|---|---|
name |
A temporary, backup or quarantined file name. |
Returns: The main file name, or the name unchanged when it is already a main file.
Staging(string)
public static string Staging(string mainName);
The name the file being replaced is parked under during a save, between the swap and the moment it becomes the newest backup. It uses backup number zero, so it is already treated as one of Shipready own working copies and never matches a Steam Cloud pattern of *.save.
| Parameter | Description |
|---|---|
mainName |
The main file name. |
Returns: The staging file name.
Temporary(string)
public static string Temporary(string mainName);
The name of the temporary file for a save.
| Parameter | Description |
|---|---|
mainName |
The main file name, for example slot_01.save. |
Returns: The temporary file name.
SaveFileReadResult #
struct in RareGeometry.Shipready.Save.Files · assembly RareGeometry.Shipready.Save
public struct SaveFileReadResult
What reading one save file produced.
Fields
HasValidBackup
public bool HasValidBackup;
Filled by SaveFileStore.ReadInfo(string) when the main file is damaged or missing: whether the temporary file or a backup reads as a valid save, which is what Restore backup would put back.
Header
public SaveHeader Header;
The header of the copy that was read, when one was readable.
Info
public SaveNode Info;
The slot info of the copy that was read, when one was readable.
MainFileDamaged
public bool MainFileDamaged;
Filled by SaveFileStore.ReadInfo(string): whether the main file is there but damaged. The header and slot info then come from the newest valid copy, when there is one, because that is what a load or a restore would bring back.
QuarantinedAs
public string QuarantinedAs;
Where a damaged main file was moved aside to, or null.
Result
public LoadResult Result;
The result to hand the game, including the report and the documentation link.
Tree
public SaveTree Tree;
The save, or null when it could not be read.
SaveFileStatus #
class in RareGeometry.Shipready.Save.Files · assembly RareGeometry.Shipready.Save
public sealed class SaveFileStatus
What one save file looks like on disk, for the Save Inspector: whether it reads, how it is packed, which save version wrote it and how many backups it has. Worked out by SaveFileStore.DescribeFile(string, int), which only reads: nothing is moved, renamed, quarantined or written.
Properties
BackupCount
public int BackupCount { get; }
How many rotating backups (.bak1 to .bak5) exist.
Bytes
public long Bytes { get; }
The size of the main file in bytes, or 0 when it is missing.
Code
public SaveErrorCode Code { get; }
What is wrong with the main file, or SaveErrorCode.None. For example SaveErrorCode.EncryptionKeyWrong for a save encrypted with another passphrase.
Compressed
public bool Compressed { get; }
Whether the data is GZip compressed.
Damaged
public bool Damaged { get; }
Whether the main file is missing or cannot be read as a save: cut short, edited, not valid JSON, or encrypted with another key. A load falls back to a backup.
Detail
public string Detail { get; }
The problem in plain English, or an empty string when there is none.
EditedByHand
public bool EditedByHand { get; }
Whether a readable file no longer matches its own checksum, because somebody edited it by hand. The Editor loads it anyway; a build follows the checksum policy.
Encrypted
public bool Encrypted { get; }
Whether the data is encrypted. Known from the readable header, even when the key is wrong.
Exists
public bool Exists { get; }
Whether the main file is there. A save can have backups without it.
FileName
public string FileName { get; }
The main file name the status describes, for example slot_01.save.
GameVersion
public string GameVersion { get; }
The game version that wrote it, or an empty string when unknown.
HasValidBackup
public bool HasValidBackup { get; }
For a damaged or missing main file: whether the temporary file or a backup reads as a valid save, which is what a load falls back to and what Restore backup puts back.
Newer
public bool Newer { get; }
Whether a higher save version wrote it, so this build refuses to load it.
Ok
public bool Ok { get; }
Whether the main file reads and passes its checks (checksum, or the tamper check of an encrypted file). A save from a newer save version can be Ok and still refuse to load; see Newer.
Older
public bool Older { get; }
Whether a lower save version wrote it, so migration steps run when it loads.
SavedUtc
public DateTime SavedUtc { get; }
When the save was written, in UTC, from its header. DateTime.MinValue when unknown.
SaveVersion
public int SaveVersion { get; }
The game's save version that wrote it, or 0 when the header could not be read.
Summary
public string Summary { get; }
A one or two word summary for a list: OK, Damaged, Wrong key, Missing, Newer version or Older version.
Methods
ToString()
public override string ToString();
The status as one line, for logs.
Returns: The file name, the summary and the problem, if any.
SaveFileStore #
class in RareGeometry.Shipready.Save.Files · assembly RareGeometry.Shipready.Save
public sealed class SaveFileStore
One save file, read and written safely. This is the layer the slots, the menu and the Save Inspector all sit on: it packs and unpacks the envelope, keeps the backups, falls back when a file is damaged, and makes sure two saves of the same file never overlap.
Work that does not need Unity runs on a background thread. Requests for the same file are queued and run in the order they arrived, so a quicksave fired twice in a second leaves the second one on disk, not the first.
Constructors
SaveFileStore(ISaveStorage, SaveFileOptions)
public SaveFileStore(ISaveStorage storage, SaveFileOptions options);
Builds a store over a storage.
| Parameter | Description |
|---|---|
storage |
Where the files live. Null is accepted rather than refused: every call then returns a SaveErrorCode.NotInitialised result pointing at the Setup Wizard, because Shipready never throws out of its public API. |
options |
The file options to use. Null uses the defaults. |
Properties
AcceptEditedFiles
public bool AcceptEditedFiles { get; set; }
Whether a file whose checksum no longer matches is loaded anyway. True in the Editor, so a developer can edit a save while testing, and otherwise follows the settings.
Options
public SaveFileOptions Options { get; set; }
The file options used for every file that has no options of its own (see SetOptionsFor(string, SaveFileOptions)). Changing them affects the next save, not existing files.
Storage
public ISaveStorage Storage { get; }
Where the files live.
Methods
CountBackups(string)
public int CountBackups(string fileName);
How many backups of a save exist right now.
| Parameter | Description |
|---|---|
fileName |
The main file name. |
Returns: A count from 0 to 5.
Delete(string)
public SaveResult Delete(string fileName);
Deletes a save and every backup of it. The player asked for it to be gone, so it goes.
| Parameter | Description |
|---|---|
fileName |
The main file name. |
Returns: What happened.
DescribeFile(string, int)
public SaveFileStatus DescribeFile(string fileName, int currentSaveVersion);
Describes a save without loading it into the game and without changing anything: whether the main file reads, how it is packed, which save version wrote it, when, how big it is and how many backups it has. A packed file is unpacked and verified in full, so a damaged compressed or encrypted save is caught too.
| Parameter | Description |
|---|---|
fileName |
The main file name, for example slot_01.save. |
currentSaveVersion |
The save version the game writes now, to tell older and newer saves apart. 0 or less leaves SaveFileStatus.Older and SaveFileStatus.Newer off. |
Returns: The status. Never null.
Exists(string)
public bool Exists(string fileName);
Whether a save exists, counting only the main file.
| Parameter | Description |
|---|---|
fileName |
The main file name. |
Returns: true when the main file is there.
ExistsInAnyForm(string)
public bool ExistsInAnyForm(string fileName);
Whether a save exists in any form, counting the temporary file and backups.
| Parameter | Description |
|---|---|
fileName |
The main file name. |
Returns: true when any copy is there.
GetOptionsFor(string)
public SaveFileOptions GetOptionsFor(string fileName);
The options a file is read and written with: its own, or Options.
| Parameter | Description |
|---|---|
fileName |
The main file name. Null gives Options. |
Returns: The options. Never null.
ListSaves(List<string>)
public SaveResult ListSaves(List<string> into);
Lists the save files in the storage, leaving out the temporary files, backups and quarantined copies.
| Parameter | Description |
|---|---|
into |
The list to fill. It is cleared first. |
Returns: What happened.
Read(string)
public SaveFileReadResult Read(string fileName);
Reads a save and waits for it to finish, falling back through the backups when the main file is unusable.
| Parameter | Description |
|---|---|
fileName |
The main file name. |
Returns: What happened, including the save on success.
Read(string, Func<SaveFileReadResult, SaveFileReadResult>)
public SaveFileReadResult Read(string fileName, Func<SaveFileReadResult, SaveFileReadResult> prepare);
Reads a save and then hands it to a second step, such as a version check and the migrations, in the same piece of work, and waits for both to finish.
| Parameter | Description |
|---|---|
fileName |
The main file name. |
prepare |
What to do with the save once it is read. It runs on a background thread, so it must not touch Unity objects. Null does nothing. If it throws, the result is a SaveErrorCode.Unknown failure rather than an exception. |
Returns: What the second step made of the read.
ReadAsync(string)
public Task<SaveFileReadResult> ReadAsync(string fileName);
Reads a save on a background thread, falling back through the backups when the main file is unusable.
| Parameter | Description |
|---|---|
fileName |
The main file name. |
Returns: A task that finishes with the result. It never faults.
ReadAsync(string, Func<SaveFileReadResult, SaveFileReadResult>)
public Task<SaveFileReadResult> ReadAsync(string fileName, Func<SaveFileReadResult, SaveFileReadResult> prepare);
The background version of Read(string, Func<SaveFileReadResult, SaveFileReadResult>): reading, unpacking and the second step all happen on a background thread.
| Parameter | Description |
|---|---|
fileName |
The main file name. |
prepare |
What to do with the save once it is read. Runs on a background thread. |
Returns: A task that finishes with the result. It never faults.
ReadFileAsIs(string)
public SaveFileReadResult ReadFileAsIs(string name);
Reads one file exactly as it is, whatever it is: the main file, a backup (.bak1), the temporary file (.tmp) or a quarantined copy (.corrupt-<time>). There is no fallback: a damaged file is reported, not replaced by a backup. Nothing is moved, quarantined or written. A file whose checksum no longer matches is read when AcceptEditedFiles is on or the checksum policy accepts edits, with a warning in the report.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
Returns: What happened. On success the tree, header and slot info are set. On failure the header and slot info are still set when the readable header of a packed file could be read, so a damaged or wrongly keyed file can still show what it is.
ReadInfo(string)
public SaveFileReadResult ReadInfo(string fileName);
Reads the header and the slot info for the menu's list of slots, and checks the file the way a load would: a readable save is parsed and its checksum checked, and a packed (compressed or encrypted) save is unpacked and its checksum or tamper check verified. It never moves or writes a file. When the main file is damaged or missing, the copies are looked through as a load would, and the result says so in SaveFileReadResult.MainFileDamaged and SaveFileReadResult.HasValidBackup.
| Parameter | Description |
|---|---|
fileName |
The main file name. |
Returns: What happened. The tree is left null unless the file keeps its info packed.
RestoreBackup(string)
public SaveResult RestoreBackup(string fileName);
Puts the newest valid backup of a damaged save back in place as the main file, and waits for it to finish.
The backup's bytes are copied unchanged through the crash-safe write (temporary file, read back and check, one swap), so the restored file keeps the backup's save time. The damaged main file is kept aside as .corrupt-<time>, and the backups stay where they are. A main file that reads correctly is never replaced.
| Parameter | Description |
|---|---|
fileName |
The main file name. |
Returns: SaveErrorCode.RecoveredFromBackup on success; SaveErrorCode.FileDamaged when no backup is valid, with nothing changed; SaveErrorCode.InvalidArgument when the main file is healthy.
RestoreBackupAsync(string)
public Task<SaveResult> RestoreBackupAsync(string fileName);
The background version of RestoreBackup(string).
| Parameter | Description |
|---|---|
fileName |
The main file name. |
Returns: A task that finishes with the result. It never faults.
SetOptionsFor(string, SaveFileOptions)
public void SetOptionsFor(string fileName, SaveFileOptions options);
Gives one file its own options, such as the global settings file with SaveKitSettings.GlobalFileOptions. Its backups, temporary file and damaged copies use them too. Every call for that file name uses them from then on, including ListSaves(List<string>), which also lists files with their extension.
| Parameter | Description |
|---|---|
fileName |
The main file name, for example global.local. Null or empty does nothing. |
options |
The options. Null goes back to Options. |
Verify(string)
public SaveResult Verify(string fileName);
Checks a save without using its contents, for a status badge in the menu or the Save Inspector.
| Parameter | Description |
|---|---|
fileName |
The main file name. |
Returns: What happened.
Write(string, SaveTree)
public SaveResult Write(string fileName, SaveTree tree);
Writes a save and waits for it to finish. This is the path used when the game is quitting or being suspended, because the operating system will not wait for a background thread.
| Parameter | Description |
|---|---|
fileName |
The main file name, for example slot_01.save. |
tree |
The save to write. |
Returns: What happened.
WriteAsync(string, SaveTree)
public Task<SaveResult> WriteAsync(string fileName, SaveTree tree);
Writes a save on a background thread.
| Parameter | Description |
|---|---|
fileName |
The main file name, for example slot_01.save. |
tree |
The save to write. |
Returns: A task that finishes with the result. It never faults.
WriteMerged(string, SaveMergeJob)
public SaveResult WriteMerged(string fileName, SaveMergeJob job);
Reads the file already on disk, lets a job decide what to write from it, then writes that, all as one piece of work in the queue for the file, and waits for it to finish. This is how a partial save keeps the categories it leaves out.
| Parameter | Description |
|---|---|
fileName |
The main file name, for example slot_01.save. |
job |
Decides what to write. Its methods run on a background thread. |
Returns: What happened.
WriteMergedAsync(string, SaveMergeJob)
public Task<SaveResult> WriteMergedAsync(string fileName, SaveMergeJob job);
The background version of WriteMerged(string, SaveMergeJob): reading, merging, packing and writing all happen on a background thread, in the queue for the file.
| Parameter | Description |
|---|---|
fileName |
The main file name, for example slot_01.save. |
job |
Decides what to write. Its methods run on a background thread. |
Returns: A task that finishes with the result. It never faults.
SaveHeader #
class in RareGeometry.Shipready.Save.Files · assembly RareGeometry.Shipready.Save
public sealed class SaveHeader
The bookkeeping at the front of every save file: which envelope format it uses, which save version the game was on, when it was written, how it is packed, and the checksum that proves it is intact.
The header is always readable, even when the data is encrypted, so the menu can list slots and the Save Inspector can report on a file without having to unpack it.
Properties
Checksum
public string Checksum { get; set; }
The checksum of the data section, in the form crc32:XXXXXXXX.
Format
public int Format { get; set; }
The envelope format number, which changes only when the envelope changes.
GameVersion
public string GameVersion { get; set; }
The game version string, for support reports. Never used to decide anything.
KeyCheck
public string KeyCheck { get; set; }
A short value that says which passphrase encrypted the file, so a save written with another passphrase can be told apart from one that has been tampered with. Empty for a file that is not encrypted.
KitVersion
public string KitVersion { get; set; }
Shipready version that wrote the file.
Packing
public SavePacking Packing { get; set; }
How the data section is packed.
SavedUtc
public DateTime SavedUtc { get; set; }
When the file was written, in UTC.
SaveVersion
public int SaveVersion { get; set; }
The game save version this file was written at. A developer raises it whenever old saves need help to load, and writes a migration step for the step up.
SlotInfoPacked
public bool SlotInfoPacked { get; set; }
Whether the slot info sits inside the packed data rather than in the header.
Constants
FormatField
public const string FormatField = "aiosk";
The member name the envelope format number is stored under.
Methods
Clone()
public SaveHeader Clone();
A copy of this header.
Returns: A new header holding the same values.
CreateNew(int, string)
public static SaveHeader CreateNew(int saveVersion, string gameVersion);
A header for a new save, stamped with Shipready version and the current time.
| Parameter | Description |
|---|---|
saveVersion |
The game save version to record. |
gameVersion |
The game version string to record. Null becomes empty. |
Returns: A new header.
FromNode(SaveNode, int)
public static SaveHeader FromNode(SaveNode node, int format);
Reads a header back out of a tree node. Missing fields take sensible defaults, so a file written by an older patch of Shipready still loads.
| Parameter | Description |
|---|---|
node |
The object node to read. Null gives a header with default values. |
format |
The envelope format number, which lives outside the header node. |
Returns: A header. Never null.
IsCompressed(SavePacking)
public static bool IsCompressed(SavePacking packing);
Whether this packing involves compression.
| Parameter | Description |
|---|---|
packing |
The packing to test. |
Returns: true when the data is compressed.
IsEncrypted(SavePacking)
public static bool IsEncrypted(SavePacking packing);
Whether this packing involves encryption.
| Parameter | Description |
|---|---|
packing |
The packing to test. |
Returns: true when the data is encrypted.
PackingFor(bool, bool)
public static SavePacking PackingFor(bool compressed, bool encrypted);
The packing that matches a pair of switches.
| Parameter | Description |
|---|---|
compressed |
Whether to compress. |
encrypted |
Whether to encrypt. |
Returns: The matching packing.
PackingToText(SavePacking)
public static string PackingToText(SavePacking packing);
The packing as the short text stored in a file.
| Parameter | Description |
|---|---|
packing |
The packing to name. |
Returns: One of readable, gzip, aes or gzip+aes.
TextToPacking(string)
public static SavePacking TextToPacking(string text);
The packing a short text from a file names.
| Parameter | Description |
|---|---|
text |
The text from the file. Anything unrecognised reads as readable. |
Returns: The packing.
ToNode()
public SaveNode ToNode();
The header as a tree node, which is what gets written into the file.
Returns: An object node holding every field that is set.
SaveMergeJob #
abstract class in RareGeometry.Shipready.Save.Files · assembly RareGeometry.Shipready.Save
public abstract class SaveMergeJob
Builds the save to write from the copy already on disk, for SaveFileStore.WriteMerged(string, SaveMergeJob) and SaveFileStore.WriteMergedAsync(string, SaveMergeJob).
Both methods run on a background thread, inside the queue for the file, so nothing else can read or write the file between reading what is there and writing what replaces it. Neither may touch Unity objects. Everything a job needs from the game has to be gathered on the main thread before the job is handed over.
Methods
AfterWrite(ISaveStorage, string, SaveReport)
public virtual void AfterWrite(ISaveStorage storage, string fileName, SaveReport report);
Called straight after the new file is safely in place, still on the background thread and still inside the queue for the file. This is step 5 of the crash-safe order: the place for files that sit beside a save, such as its thumbnail.
| Parameter | Description |
|---|---|
storage |
Where the files live. |
fileName |
The main file name that was written. |
report |
The report for this save. A problem here is a warning, never a failure. |
Merge(SaveFileReadResult, SaveReport, SaveTree)
public abstract SaveResult Merge(SaveFileReadResult existing, SaveReport report, out SaveTree tree);
Decides what to write.
| Parameter | Description |
|---|---|
existing |
What reading the file already on disk produced, including recovery from a backup. When there is no copy of the file at all, its result code is SaveErrorCode.FileNotFound and its tree is null. |
report |
The report for this save. Warnings added here reach the game. |
tree |
The save to write, or null to write nothing at all. |
Returns: A success to go ahead, which writes tree or nothing when it is null, or a failure, which leaves every file exactly as it was.
Namespace RareGeometry.Shipready.Save.Json #
JsonTextReader #
static class in RareGeometry.Shipready.Save.Json · assembly RareGeometry.Shipready.Save
public static class JsonTextReader
Reads JSON back into a save tree. It never throws: a file that is not JSON comes back as a failure with the position and reason, which the recovery loader turns into a damaged file result and moves on to the next copy.
Numbers keep the exact text they were written with, so a float comes back bit-exact and a long past 2^53 keeps every digit.
Constants
MaxDepth
public const int MaxDepth = 128;
How deeply a save may nest. The writer refuses anything deeper, so a file this reader rejects can never be a file Shipready itself wrote.
Methods
HasUtf8ByteOrderMark(byte[])
public static bool HasUtf8ByteOrderMark(byte[] bytes);
Whether a byte array starts with a UTF-8 byte order mark.
| Parameter | Description |
|---|---|
bytes |
The bytes to look at. Null returns false. |
Returns: true when the first three bytes are a UTF-8 byte order mark.
LooksLikeJson(byte[])
public static bool LooksLikeJson(byte[] bytes);
Whether a byte array looks like readable JSON rather than a packed save. The loader uses this to tell the two envelope kinds apart from the first bytes.
| Parameter | Description |
|---|---|
bytes |
The bytes to look at. Null returns false. |
Returns: true when the first non-whitespace byte opens a JSON object.
TryParse(string, SaveNode, string)
public static bool TryParse(string text, out SaveNode root, out string error);
Parses JSON text into a save tree.
| Parameter | Description |
|---|---|
text |
The JSON to parse. Null or empty fails. |
root |
The parsed tree, or null when parsing failed. |
error |
Why parsing failed, with a character position. Null on success. |
Returns: true when the whole text parsed as one JSON value.
TryParseUtf8(byte[], SaveNode, string)
public static bool TryParseUtf8(byte[] utf8, out SaveNode root, out string error);
Parses UTF-8 bytes into a save tree, skipping a byte order mark when one is present.
| Parameter | Description |
|---|---|
utf8 |
The bytes to parse. Null or empty fails. |
root |
The parsed tree, or null when parsing failed. |
error |
Why parsing failed. Null on success. |
Returns: true when the bytes parsed as one JSON value.
JsonTextWriter #
static class in RareGeometry.Shipready.Save.Json · assembly RareGeometry.Shipready.Save
public static class JsonTextWriter
Writes a save tree as JSON. Shipready has its own writer rather than using JsonUtility for the whole file, because the tree has to come back exactly as it went in: member order preserved, numbers in the text they were written with, and nothing that depends on the machine language settings.
Compact output is deterministic: the same tree always produces the same bytes. The checksum in the save header is measured over compact output, so turning pretty-printing on or off never changes a checksum.
Methods
ToJson(SaveNode, bool)
public static string ToJson(SaveNode node, bool pretty);
A tree as a JSON string.
| Parameter | Description |
|---|---|
node |
The tree to write. Null returns null. |
pretty |
true for indented output a person can read, false for the compact form. |
Returns: The tree as JSON. Never null.
Write(SaveNode, StringBuilder, bool)
public static void Write(SaveNode node, StringBuilder output, bool pretty);
Writes a tree into a string builder.
| Parameter | Description |
|---|---|
node |
The tree to write. Null writes null. |
output |
Where to write. Must not be null. |
pretty |
true for indented output a person can read, false for the compact form used in release builds and for the checksum. |
JsonUtilityBridge #
static class in RareGeometry.Shipready.Save.Json · assembly RareGeometry.Shipready.Save
public static class JsonUtilityBridge
Saves a developer own [Serializable] class or struct by handing it to Unity and then folding the result into the save tree. The rule this gives a developer is simple: if the Inspector shows the value, Shipready can save it.
The result is folded into the tree rather than stored as a blob of text, so a custom class is still searchable in the Save Inspector and still reachable by a migration.
Methods
ToNode(object)
public static SaveNode ToNode(object value);
Turns a value into a save tree node using the Unity serialisation rules, which are the same rules that decide what the Inspector shows.
| Parameter | Description |
|---|---|
value |
The value to convert. Null becomes a null node. |
Returns: The value as a tree. A type Unity cannot serialise comes back as an empty object node, which the Field Picker and Diagnostics both report rather than hide.
ToValue<T>(SaveNode, T)
public static T ToValue<T>(SaveNode node, T fallback);
Builds a value of a given type from a save tree node.
| Type parameter | Description |
|---|---|
T |
The type to build. Must be one Unity can serialise. |
| Parameter | Description |
|---|---|
node |
The node to read. Null or a non-object node returns the fallback. |
fallback |
What to return when the value cannot be built. |
Returns: The value, or the fallback.
ToValueOfType(SaveNode, Type)
public static object ToValueOfType(SaveNode node, Type type);
Builds a value from a save tree node, given the type as a Type rather than a type parameter. The Field Picker needs this, because it works from a reflected field.
| Parameter | Description |
|---|---|
node |
The node to read. Null or a non-object node returns null. |
type |
The type to build. Null returns null. |
Returns: The value, or null when it cannot be built.
TryFill(SaveNode, object)
public static bool TryFill(SaveNode node, object target);
Fills an existing object from a save tree node, leaving any field the save does not mention at the value it already has. This is what makes tolerant loading work for custom classes: a field added in a game update keeps its default.
| Parameter | Description |
|---|---|
node |
The node to read. Null or a non-object node does nothing. |
target |
The object to fill. Null does nothing. |
Returns: true when the object was filled.
Namespace RareGeometry.Shipready.Save.Migration #
MigrationOutcome #
struct in RareGeometry.Shipready.Save.Migration · assembly RareGeometry.Shipready.Save
public struct MigrationOutcome
What running the migration steps did.
Fields
Code
public SaveErrorCode Code;
Why it failed, or SaveErrorCode.None.
Error
public string Error;
A plain-English reason, or null on success.
MissingVersion
public int MissingVersion;
The version that has no step, when the run stopped because of a gap. Zero otherwise.
StepsRun
public int[] StepsRun;
Which steps ran, lowest version first. Empty when none were needed.
Success
public bool Success;
Whether the save reached the version the game is on.
MigrationRunner #
class in RareGeometry.Shipready.Save.Migration · assembly RareGeometry.Shipready.Save
public sealed class MigrationRunner
Runs the migration steps that bring an old save up to the version the game is on.
Steps run in order, one version at a time, so a save from three versions ago passes through every step in between rather than needing its own special case. A gap in that chain is reported rather than guessed at: loading a save the game only half understands is how progress gets quietly mangled.
A step can arrive two ways: added by hand with Add(int, Action<SaveTree>, string), or found through the [SaveMigration] attribute. A step added by hand always wins over a found one for the same version, whichever was registered first. Two found steps for the same version are a mistake in the game, so only the first one in a fixed order (assembly name, then type name, then method name) is used and the Console names both.
Properties
Count
public int Count { get; }
How many versions have a step, counting each version once.
Methods
Add(int, Action<SaveTree>)
public void Add(int fromVersion, Action<SaveTree> step);
Adds a step by hand with a generated description.
| Parameter | Description |
|---|---|
fromVersion |
The version this step upgrades from. |
step |
What to do to the save. |
Add(int, Action<SaveTree>, string)
public void Add(int fromVersion, Action<SaveTree> step, string description);
Adds a step by hand, or replaces the step already added by hand for that version. A step added by hand always wins over one found through [SaveMigration], whether it is added before or after Shipready starts, so a game can override a step Shipready discovered automatically.
| Parameter | Description |
|---|---|
fromVersion |
The version this step upgrades from. Must be 1 or more. |
step |
What to do to the save. Null is ignored. It runs on a background thread, so it must only edit the tree and must not touch Unity objects. |
description |
A name for reports. Null uses a generated one. |
Clear()
public void Clear();
Forgets every registered step, however it arrived.
Describe(int)
public string Describe(int fromVersion);
The description of the step that will run for a version.
| Parameter | Description |
|---|---|
fromVersion |
The version to describe the step for. |
Returns: The description, or null when there is no step.
DiscoverInLoadedAssemblies()
public int DiscoverInLoadedAssemblies();
Looks through every loaded assembly for static methods marked [SaveMigration] and registers them.
The assemblies, types and methods are walked in a fixed order (assembly name, then type name, then method name), so the same project always registers the same steps. When two methods are marked for the same version, only the first is registered and a warning names both. Running this again finds the same methods and adds nothing.
A build with code stripping switched on can remove a method nothing appears to call, which is why Shipready also writes a link file during a build listing the types these methods live in.
Returns: How many steps were added.
DiscoverInType(Type)
public int DiscoverInType(Type type);
Looks through one type for static methods marked [SaveMigration]. Steps found this way follow the same rules as automatic discovery: a step added by hand still wins, and a second method for a version that already has a found step is ignored with a warning.
| Parameter | Description |
|---|---|
type |
The type to look in. Null does nothing. |
Returns: How many steps were added.
GetVersions()
public int[] GetVersions();
The versions that have a step, lowest first.
Returns: A fresh array. Never null.
HasPath(int, int, int)
public bool HasPath(int fromVersion, int targetVersion, out int missingVersion);
Whether there is an unbroken chain of steps from a version up to the one the game is on.
| Parameter | Description |
|---|---|
fromVersion |
The version the save file is at. |
targetVersion |
The version the game is on. |
missingVersion |
The first version with no step, or zero when the chain is whole. |
Returns: true when every step in between exists.
Remove(int)
public bool Remove(int fromVersion);
Removes the step for a version, both the one added by hand and the one found through the attribute.
| Parameter | Description |
|---|---|
fromVersion |
The version to remove the step for. |
Returns: true when a step was removed.
Run(SaveTree, int)
public MigrationOutcome Run(SaveTree tree, int targetVersion);
Brings a save up to the version the game is on, running each step in order.
On failure the save is left exactly as it was handed in, so the caller can refuse the load without having half-changed anything.
| Parameter | Description |
|---|---|
tree |
The save to upgrade. Null fails. |
targetVersion |
The version the game is on. |
Returns: What happened.
Namespace RareGeometry.Shipready.Save.Settings #
ChecksumPolicy #
enum in RareGeometry.Shipready.Save.Settings · assembly RareGeometry.Shipready.Save
public enum ChecksumPolicy
What Shipready does when a readable save no longer matches its own checksum.
Values
PrettyPrintMode #
enum in RareGeometry.Shipready.Save.Settings · assembly RareGeometry.Shipready.Save
public enum PrettyPrintMode
When Shipready indents a readable save file.
Values
SaveCategory #
class in RareGeometry.Shipready.Save.Settings · assembly RareGeometry.Shipready.Save
public sealed class SaveCategory
One named group of saved values. Every value Shipready stores belongs to exactly one category, which is what makes a partial save possible: a checkpoint can write Progress and World and leave everything else in the file as it was.
Constructors
SaveCategory(string, SaveCategoryScope)
public SaveCategory(string name, SaveCategoryScope scope);
Builds a category.
| Parameter | Description |
|---|---|
name |
The category name, as the game refers to it in code. |
scope |
Whether it lives in each slot or in one global file. |
Properties
IsGlobal
public bool IsGlobal { get; }
Whether this category lives in one file for the whole game.
Name
public string Name { get; set; }
The category name, as the game refers to it in code.
Scope
public SaveCategoryScope Scope { get; set; }
Whether this category lives in each slot or in one global file.
Methods
ToString()
public override string ToString();
The category as text, for the Inspector and for log lines.
Returns: The name and scope.
SaveCategoryScope #
enum in RareGeometry.Shipready.Save.Settings · assembly RareGeometry.Shipready.Save
public enum SaveCategoryScope
Where the values in a category are kept.
Values
SaveFileOptions #
class in RareGeometry.Shipready.Save.Settings · assembly RareGeometry.Shipready.Save
public sealed class SaveFileOptions
How save files are written: readable or packed, how many backups to keep, the extension, and what to do about a file that has been edited.
The settings asset holds two sets: SaveKitSettings.FileOptions for the slots, the autosaves and the quicksave, and SaveKitSettings.GlobalFileOptions, which the global settings file uses instead when SaveKitSettings.UseSlotOptionsForGlobalFile is off. A SaveFileStore applies one set to every file unless it is given a set for a particular file.
Changing any of these in a game update never strands existing saves. Each file records how it was packed (readable, compressed, encrypted), and the loader follows the file rather than the settings. Only the passphrase has to stay the same for encrypted files.
Properties
AutomaticFallback
public bool AutomaticFallback { get; set; }
Whether a load falls back to the newest valid backup on its own when the main file is damaged. On by default: the player gets the backup, the damaged file is kept aside as .corrupt-<time>, and the result says SaveErrorCode.RecoveredFromBackup.
When off, a damaged or missing main file of a slot, an autosave or the quicksave is never replaced by a backup on load. The load fails with the damage code, nothing is moved aside, and the slot info reports SlotInfo.IsDamaged and SlotInfo.HasValidBackup, so the menu can offer Restore backup, which calls SaveKit.RestoreBackup(int).
The global file, which holds the player's settings, always falls back, whatever this says. Saving over a damaged slot also works the same either way: the save keeps the categories it does not write from the newest valid copy, and the damaged file is kept aside.
With fallback off, a crash during the very first save of a slot, before the new file was swapped into place, leaves only the temporary file (.tmp). The slot then lists as damaged and its load reports damage (SK101); Restore backup puts that temporary file in place, because it counts as a backup.
BackupCount
public int BackupCount { get; set; }
How many rotating backups to keep per file, from 0 to 5. Two by default, which is one more copy than most players ever need and still almost no disk space.
ChecksumPolicy
public ChecksumPolicy ChecksumPolicy { get; set; }
What to do about a readable save that no longer matches its own checksum.
Compress
public bool Compress { get; set; }
Whether the data section is GZip compressed. Off by default, because a typical save is small; worth turning on for a large world.
Encrypt
public bool Encrypt { get; set; }
Whether the data section is encrypted with a tamper check. Off by default. This stops a player editing a save in a text editor; it is not anti-cheat, because the key ships inside the game.
EncryptSlotInfo
public bool EncryptSlotInfo { get; set; }
Whether the slot info is encrypted as well as the data. Off by default, so the menu can show names, dates and thumbnails without decrypting anything.
FileExtension
public string FileExtension { get; set; }
The extension save files are written with. Backups, temporary files and quarantined copies deliberately use different extensions, so a Steam Auto-Cloud pattern of *.save uploads only the real saves.
HasOwnFileExtension
public bool HasOwnFileExtension { get; }
Whether an extension was set, rather than left empty for the default. The global file's options use the slots' extension when they set none.
IsUsingDefaultPassphrase
public bool IsUsingDefaultPassphrase { get; }
Whether the passphrase is still the one a fresh settings asset ships with.
KeyIterations
public int KeyIterations { get; set; }
How many times the passphrase is stretched into a key. Keys are derived once at startup.
KeySalt
public string KeySalt { get; set; }
The salt mixed into key derivation, as base64. The wizard fills it with random bytes so that two games using the same passphrase still get different keys. An empty salt falls back to a fixed one derived from the product name.
Passphrase
public string Passphrase { get; set; }
The passphrase the encryption keys are derived from.
PrettyPrint
public PrettyPrintMode PrettyPrint { get; set; }
When a readable save is indented.
Constants
DefaultExtension
public const string DefaultExtension = ".save";
The file extension Shipready writes, which Steam Auto-Cloud patterns match on.
DefaultKeyIterations
public const int DefaultKeyIterations = 100000;
How many times the passphrase is stretched into a key. More is slower to start.
DefaultPassphrase
public const string DefaultPassphrase = "change-me-before-you-ship";
The passphrase a fresh settings asset starts with. Diagnostics warns while this is still in place, because a shipped game that keeps it gains nothing from encryption.
Methods
Clone()
public SaveFileOptions Clone();
A copy of these options, so a call can adjust them without changing the asset.
Returns: A new instance holding the same values.
CreateDefault()
public static SaveFileOptions CreateDefault();
The readable, unpacked defaults: plain JSON, two backups, edits treated as damage.
Returns: A new instance holding the default values.
CreateForGlobalFile()
public static SaveFileOptions CreateForGlobalFile();
The defaults for SaveKitSettings.GlobalFileOptions: the same as CreateDefault(), except that no extension is set, so the global file keeps the slots' extension until one is chosen.
Returns: A new instance.
ShouldPrettyPrint()
public bool ShouldPrettyPrint();
Whether a file written with these options should be indented, given where the game is running.
Returns: true when the writer should indent.
SaveKitSettings #
class in RareGeometry.Shipready.Save.Settings · assembly RareGeometry.Shipready.Save
public sealed class SaveKitSettings : ScriptableObject
Every choice a game makes about saving, in one asset. The Setup Wizard creates it and fills it in; Shipready reads it and never writes to it at runtime.
The asset lives in a Resources folder in the game own project, not inside the Shipready folder, so that updating Shipready never overwrites a developer settings.
Properties
AssetRegistry
public AssetRegistry AssetRegistry { get; set; }
The assets a save may link to, such as item definitions. The Editor keeps it up to date.
AutoDiscoverMigrations
public bool AutoDiscoverMigrations { get; set; }
Whether Shipready looks through the loaded assemblies for methods marked [SaveMigration] when it starts. On by default, so a developer only has to write the method.
AutosaveEnabled
public bool AutosaveEnabled { get; }
Whether any autosave trigger is switched on.
AutosaveFileCount
public int AutosaveFileCount { get; set; }
How many autosave files to rotate through.
AutosaveFileNameFormat
public string AutosaveFileNameFormat { get; set; }
The pattern autosave file names are made from, without the extension. {0} stands for the autosave number. Empty uses DefaultAutosaveFileNameFormat.
AutosaveIntervalSeconds
public float AutosaveIntervalSeconds { get; set; }
How many seconds between timed autosaves.
AutosaveOnQuit
public bool AutosaveOnQuit { get; set; }
Whether Shipready autosaves when the game quits or is suspended. On by default, and the one trigger most games want, because it is the one players notice is missing.
AutosaveOnSceneChange
public bool AutosaveOnSceneChange { get; set; }
Whether Shipready autosaves when the game changes scene.
AutosaveOnTimer
public bool AutosaveOnTimer { get; set; }
Whether Shipready autosaves on a timer.
CaptureAutosaveThumbnails
public bool CaptureAutosaveThumbnails { get; set; }
Whether every slot save, autosave and quicksave gets a thumbnail. On by default. Before a slot save, autosave or quicksave that has no picture set with SaveKit.SetNextThumbnail(Texture2D), Shipready renders SaveKit.ThumbnailCamera, or Camera.main when none is set, into a 320×180 picture on the main thread. Without a camera or a graphics device (a server or a -nographics run) there is simply no picture, and on a phone or handheld being suspended no picture is taken, because the game may no longer draw then. Switch it off to keep saves free of that rendering or to set the pictures yourself.
Categories
public IReadOnlyList<SaveCategory> Categories { get; }
The categories this game defines.
DefaultCategory
public string DefaultCategory { get; set; }
The category a value goes into when the game does not name one.
FileOptions
public SaveFileOptions FileOptions { get; set; }
How save files are written: readable or packed, how many backups, and the extension. These are the options of the slots, the autosaves and the quicksave, and of the global settings file too unless UseSlotOptionsForGlobalFile is off.
GlobalFileExtension
public string GlobalFileExtension { get; }
The extension of the global settings file: the slots' one, unless the global file has its own options and extension.
GlobalFileName
public string GlobalFileName { get; }
The file name for the global file, including the extension: the slots' extension, or the global file's own one (see GlobalFileExtension).
GlobalFileOptions
public SaveFileOptions GlobalFileOptions { get; set; }
The global settings file's own options, used when UseSlotOptionsForGlobalFile is off: pretty-printing, compression, encryption (and of the slot info), backups, checksum policy and file extension. An empty extension means the slots' extension.
The passphrase, salt and key iterations here are never used: every file of a game shares the key from FileOptions, so a settings file written under either setting can always be read. Switching between the two never strands an old file either, because each file records how it was packed; and when the extension changes, Shipready loads whichever of the old and the new settings file was written last, so the player's latest settings come back, and the next save writes the new name. The old file is left where it is. Shipready reads these options when it starts.
InitialiseAutomatically
public bool InitialiseAutomatically { get; set; }
Whether Shipready starts by itself when the game runs, just before the first scene loads, using this asset from its Resources folder. On by default, so a game made with the Setup Wizard saves without any code. Switch it off to start Shipready yourself with SaveKit.Initialise(), for example after choosing a profile folder. Calling SaveKit.Initialise() while it is on is fine: Shipready simply starts again with the settings given.
LogLevel
public SaveLogLevel LogLevel { get; set; }
How much Shipready writes to the Console.
PrefabRegistry
public PrefabRegistry PrefabRegistry { get; set; }
The prefabs a load can re-create runtime objects from. The Editor keeps it up to date.
ProfileFolder
public string ProfileFolder { get; set; }
A folder inside the save folder that keeps one player's saves apart from another's on a shared machine. Empty, the default, means everybody on the machine shares one save folder.
{profile} in it is replaced, when Shipready starts, by SaveKit.ProfileId, which the game sets at runtime, for example to the player's Steam ID. So {profile} saves Steam user 76561198000000000 into Saves/76561198000000000, the folder a Steam Auto-Cloud subdirectory of Saves/{64BitSteamID} matches. Steam itself fills in nothing here: Shipready only knows the id the game gives it. Text without {profile} is used as it is, as one fixed folder name. See ResolveProfileFolder(string, string, string).
ProfileFolderNeedsProfileId
public bool ProfileFolderNeedsProfileId { get; }
Whether ProfileFolder holds ProfilePlaceholder, so Shipready needs a profile id to start.
QuicksaveEnabled
public bool QuicksaveEnabled { get; set; }
Whether the quicksave slot is available. Off by default.
QuicksaveFileName
public string QuicksaveFileName { get; }
The file name for the quicksave, including the extension.
ReportToConsole
public bool ReportToConsole { get; set; }
Whether every save and load prints a one-line report to the Console: what it was, the file, the counts, the time, the file size and how many warnings it had. Off by default, so the Console stays quiet; every report is still in the Save Inspector's Recent saves and loads. It prints at SaveLogLevel.Warnings and SaveLogLevel.Verbose (Verbose adds the time of each stage); at Errors and Off nothing is printed. The warnings themselves are always printed as warnings at Warnings and above, whatever this says. Copied into SaveLog.ReportToConsole when Shipready starts.
SaveFolderName
public string SaveFolderName { get; set; }
The folder inside the persistent data path that saves are kept in.
SaveVersion
public int SaveVersion { get; set; }
The save version this build writes. A developer raises it whenever old saves need help to load, and writes a migration step for the step up.
SceneRegistry
public SceneRegistry SceneRegistry { get; set; }
The scenes Shipready saves, by GUID, so renaming or moving a scene never breaks a save.
SlotCount
public int SlotCount { get; set; }
How many manual slots the player gets, from 1 to 99.
SlotFileNameFormat
public string SlotFileNameFormat { get; set; }
The pattern slot file names are made from, without the extension. {0} stands for the slot number, so slot_{0:00} gives slot_01. Empty uses DefaultSlotFileNameFormat.
UseSlotOptionsForGlobalFile
public bool UseSlotOptionsForGlobalFile { get; set; }
Whether the global settings file is written with FileOptions, like the slots. On by default. Switch it off to give the settings file its own options in GlobalFileOptions, for example a different extension such as .local to keep machine-specific settings out of a Steam Auto-Cloud pattern of *.save.
WorldCategory
public string WorldCategory { get; set; }
The category Saveables are saved in when they do not name one, and the category that records which scenes were loaded. It has to be one of the categories. Empty uses DefaultWorldCategoryName.
WorldLoadMode
public WorldLoadMode WorldLoadMode { get; set; }
How a load treats scenes. Copied into SaveWorld.LoadMode when Shipready starts.
Constants
DefaultAutosaveFileNameFormat
public const string DefaultAutosaveFileNameFormat = "autosave_{0}";
The autosave file name pattern used when none is set, or the one set cannot be used.
DefaultCategoryName
public const string DefaultCategoryName = "Progress";
The category a value goes into when the game does not name one.
DefaultSlotFileNameFormat
public const string DefaultSlotFileNameFormat = "slot_{0:00}";
The slot file name pattern used when none is set, or the one set cannot be used.
DefaultWorldCategoryName
public const string DefaultWorldCategoryName = "World";
The category Saveables are saved in when they do not name one.
MaximumSlotCount
public const int MaximumSlotCount = 99;
The largest number of manual slots Shipready supports.
ProfilePlaceholder
public const string ProfilePlaceholder = "{profile}";
The placeholder in ProfileFolder that SaveKit.ProfileId replaces.
ResourceName
public const string ResourceName = "ShipreadySaveSettings";
The name the settings asset is loaded by, without a folder or extension.
Methods
FindCategory(string)
public SaveCategory FindCategory(string name);
The category with a name.
| Parameter | Description |
|---|---|
name |
The category name. Compared exactly, including case. |
Returns: The category, or null when there is no such category.
GetAutosaveFileName(int)
public string GetAutosaveFileName(int index);
The file name for one of the rotating autosaves, including the extension. Never throws, in the same way as GetSlotFileName(int).
| Parameter | Description |
|---|---|
index |
Which autosave file, counting from 1. |
Returns: A storage-relative file name.
GetCategoryNames(SaveCategoryScope, List<string>)
public void GetCategoryNames(SaveCategoryScope scope, List<string> into);
Fills a list with the names of the categories of one scope.
| Parameter | Description |
|---|---|
scope |
Which scope to list. |
into |
The list to fill. It is cleared first. Null does nothing. |
GetEarlierGlobalFileNames(List<string>)
public void GetEarlierGlobalFileNames(List<string> into);
The names the global file had under the other setting of UseSlotOptionsForGlobalFile: the base name with the slots' extension and with the global file's own extension, leaving out GlobalFileName itself. Shipready loads the settings file from one of these when the current name has no copy yet, so changing the extension in a game update keeps the player's settings.
| Parameter | Description |
|---|---|
into |
The list to fill. It is cleared first. Null does nothing. |
GetGlobalFileOptions()
public SaveFileOptions GetGlobalFileOptions();
The options the global settings file is actually written and read with: a copy of FileOptions when UseSlotOptionsForGlobalFile is on, otherwise a copy of GlobalFileOptions with the key (passphrase, salt, iterations) of FileOptions and, when it names none, the slots' extension.
Returns: A new instance. Never null.
GetSlotFileName(int)
public string GetSlotFileName(int slot);
The file name for a manual slot, including the extension. Never throws: a pattern that cannot be used falls back to DefaultSlotFileNameFormat, and Validate(string) reports the problem when Shipready starts.
| Parameter | Description |
|---|---|
slot |
The slot number, counting from 1. |
Returns: A storage-relative file name.
HasCategory(string)
public bool HasCategory(string name);
Whether a category name is one this game defines.
| Parameter | Description |
|---|---|
name |
The category name. Compared exactly, including case. |
Returns: true when the category exists.
IsReservedCategoryName(string)
public static bool IsReservedCategoryName(string name);
Whether a name cannot be used for a category because Shipready uses it itself. A save's data section holds one member per category beside players, where each co-op player's own data is kept, so a category called players would overwrite it. The world keys (scenes, persistent, loadedScenes, activeScene) live inside a category rather than beside it, so they are free to use as category names. Compared exactly, including case.
| Parameter | Description |
|---|---|
name |
The category name. |
Returns: true when the name is reserved.
IsSlotInRange(int)
public bool IsSlotInRange(int slot);
Whether a slot number is one this game offers.
| Parameter | Description |
|---|---|
slot |
The slot number to test. |
Returns: true when the slot is between 1 and the slot count.
IsUsableProfileId(string)
public static bool IsUsableProfileId(string profileId);
Whether a profile id can be a folder name on every platform Shipready supports: not empty, no folder separator or character Windows refuses, not . or .. and no .. inside, no space or full stop at either end (Windows drops a trailing one), and not a name Windows keeps for a device (CON, PRN, AUX, NUL, COM1 to COM9, LPT1 to LPT9), with or without an extension, in any case.
| Parameter | Description |
|---|---|
profileId |
The id, such as a Steam ID. |
Returns: true when it can be used.
Load()
public static SaveKitSettings Load();
Loads the settings asset from a Resources folder.
Returns: The asset, or null when the Setup Wizard has not created it yet.
RemoveCategory(string)
public bool RemoveCategory(string name);
Removes a category. The values already in save files are left alone.
| Parameter | Description |
|---|---|
name |
The category name. |
Returns: true when a category was removed.
ResetToDefaults()
public void ResetToDefaults();
Puts every value back to Shipready defaults, including the five categories the Setup Wizard creates: Settings as global, and Progress, Inventory, Quests and World in each slot.
ResolveProfileFolder(string, string, string)
public bool ResolveProfileFolder(string profileId, out string folder, out string problem);
The profile folder for a profile id: ProfileFolder with every {profile} replaced by the id, or the folder as it is when it holds no placeholder. Never throws.
| Parameter | Description |
|---|---|
profileId |
The player's profile id, such as a Steam ID. Ignored when there is no placeholder. |
folder |
The folder inside the save folder, or an empty string for none. |
problem |
Why the id cannot be used, or null. |
Returns: true when the folder can be used.
SetCategory(string, SaveCategoryScope)
public void SetCategory(string name, SaveCategoryScope scope);
Adds a category, or changes the scope of one that already exists.
| Parameter | Description |
|---|---|
name |
The category name. |
scope |
Whether it lives in each slot or in one global file. |
Validate(string)
public SaveErrorCode Validate(out string reason);
Checks that the settings make sense before Shipready starts using them.
| Parameter | Description |
|---|---|
reason |
What is wrong, or null when nothing is. |
Returns: The code that classifies the problem, or SaveErrorCode.None.
Namespace RareGeometry.Shipready.Save.Storage #
FileSaveStorage #
class in RareGeometry.Shipready.Save.Storage · assembly RareGeometry.Shipready.Save
public sealed class FileSaveStorage : ISaveStorage
Save files on the local disk, under a folder inside Application.persistentDataPath. This is what a shipped game uses.
Writes are flushed all the way to the disk rather than left in the operating system cache, because the next step in a save verifies what was written and the step after that swaps it into place. A write that is still in a cache would make both of those lies.
Constructors
FileSaveStorage(string)
public FileSaveStorage(string folderName);
Storage under a folder of the persistent data path, which is the normal case.
| Parameter | Description |
|---|---|
folderName |
The folder inside the persistent data path. Null or empty uses Saves. |
Properties
IsUsable
public bool IsUsable { get; }
Whether this storage has somewhere to write to. It does not when the persistent data path was asked for before Unity could answer, which would otherwise leave a relative path and quietly scatter saves into the working directory.
RootPath
public string RootPath { get; }
The folder this storage keeps files in.
Constants
DefaultFolderName
public const string DefaultFolderName = "Saves";
The folder name used inside the persistent data path by default.
Methods
AtPath(string)
public static FileSaveStorage AtPath(string absolutePath);
Storage under an exact folder path. Tests and the Save Inspector use this; a game uses the persistent data path so that it works on every platform.
| Parameter | Description |
|---|---|
absolutePath |
The folder to keep saves in. |
Returns: Storage rooted at that folder.
Delete(string)
public StorageOutcome Delete(string name);
Deletes a file. Deleting a file that is not there succeeds.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
Returns: What happened.
DescribeLocation()
public string DescribeLocation();
Where this storage keeps its files, in a form safe to show a developer or put in a support email. For file storage this is the folder path.
Returns: A description of the location. Never null.
EnsureFolder()
public StorageOutcome EnsureFolder();
Creates the save folder if it is not there yet.
Returns: What happened.
Exists(string)
public bool Exists(string name);
Whether a file exists.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
Returns: true when the file is there.
GetFullPath(string)
public string GetFullPath(string name);
The full path of a file inside this storage, for the Save Inspector and for the "open save folder" action.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
Returns: The full path, or the folder itself when the name is empty.
GetLastWriteUtc(string)
public DateTime GetLastWriteUtc(string name);
When a file was last written.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
Returns: The time in UTC, or DateTime.MinValue when the file is not there.
GetLength(string)
public long GetLength(string name);
How many bytes a file holds.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
Returns: The length, or zero when the file is not there.
List(string, List<string>)
public StorageOutcome List(string searchPattern, List<string> into);
Lists file names in the storage.
| Parameter | Description |
|---|---|
searchPattern |
A simple pattern such as *.save. Null or empty lists everything. |
into |
The list to fill. It is cleared first. |
Returns: What happened.
Move(string, string, bool)
public StorageOutcome Move(string fromName, string toName, bool overwrite);
Renames or moves a file inside the storage.
| Parameter | Description |
|---|---|
fromName |
The file to move. |
toName |
Where to move it. |
overwrite |
Whether to replace an existing file at the destination. |
Returns: What happened.
Read(string, byte[])
public StorageOutcome Read(string name, out byte[] data);
Reads a whole file.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
data |
The contents, or null on failure. |
Returns: What happened.
Replace(string, string, string)
public StorageOutcome Replace(string sourceName, string destinationName, string backupName);
Puts one file in place of another in a single step, moving the file being replaced aside as a backup. This is the step that makes a save crash-safe: either the old file or the new one is in place, never half of either.
| Parameter | Description |
|---|---|
sourceName |
The file to put in place. |
destinationName |
The file to replace. It need not exist. |
backupName |
Where to move the file being replaced. Null or empty discards it. |
Returns: What happened.
Write(string, byte[])
public StorageOutcome Write(string name, byte[] data);
Writes a whole file and makes sure it has reached the disk before returning, which is what lets the next step verify it and what makes a crash afterwards survivable.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
data |
The contents to write. Null is treated as empty. |
Returns: What happened.
ISaveStorage #
interface in RareGeometry.Shipready.Save.Storage · assembly RareGeometry.Shipready.Save
public interface ISaveStorage
Where save files live. Shipready ships a file storage for the real game and a memory storage for tests; a platform that needs something else, such as browser storage or a cloud service, can plug in here without the rest of Shipready changing.
Names handed to these calls are plain file names inside the storage, never full paths, so the same save code works whatever the storage is.
Nothing here throws. Every call reports what happened, because a save system that throws when a disk fills up is a save system that loses saves.
Methods
Delete(string)
StorageOutcome Delete(string name);
Deletes a file. Deleting a file that is not there succeeds.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
Returns: What happened.
DescribeLocation()
string DescribeLocation();
Where this storage keeps its files, in a form safe to show a developer or put in a support email. For file storage this is the folder path.
Returns: A description of the location. Never null.
Exists(string)
bool Exists(string name);
Whether a file exists.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
Returns: true when the file is there.
GetLastWriteUtc(string)
DateTime GetLastWriteUtc(string name);
When a file was last written.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
Returns: The time in UTC, or DateTime.MinValue when the file is not there.
GetLength(string)
long GetLength(string name);
How many bytes a file holds.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
Returns: The length, or zero when the file is not there.
List(string, List<string>)
StorageOutcome List(string searchPattern, List<string> into);
Lists file names in the storage.
| Parameter | Description |
|---|---|
searchPattern |
A simple pattern such as *.save. Null or empty lists everything. |
into |
The list to fill. It is cleared first. |
Returns: What happened.
Move(string, string, bool)
StorageOutcome Move(string fromName, string toName, bool overwrite);
Renames or moves a file inside the storage.
| Parameter | Description |
|---|---|
fromName |
The file to move. |
toName |
Where to move it. |
overwrite |
Whether to replace an existing file at the destination. |
Returns: What happened.
Read(string, byte[])
StorageOutcome Read(string name, out byte[] data);
Reads a whole file.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
data |
The contents, or null on failure. |
Returns: What happened.
Replace(string, string, string)
StorageOutcome Replace(string sourceName, string destinationName, string backupName);
Puts one file in place of another in a single step, moving the file being replaced aside as a backup. This is the step that makes a save crash-safe: either the old file or the new one is in place, never half of either.
| Parameter | Description |
|---|---|
sourceName |
The file to put in place. |
destinationName |
The file to replace. It need not exist. |
backupName |
Where to move the file being replaced. Null or empty discards it. |
Returns: What happened.
Write(string, byte[])
StorageOutcome Write(string name, byte[] data);
Writes a whole file and makes sure it has reached the disk before returning, which is what lets the next step verify it and what makes a crash afterwards survivable.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
data |
The contents to write. Null is treated as empty. |
Returns: What happened.
MemorySaveStorage #
class in RareGeometry.Shipready.Save.Storage · assembly RareGeometry.Shipready.Save
public sealed class MemorySaveStorage : ISaveStorage
Save files held in memory. Shipready tests run against this, and a game can use it to test its own save and load code without writing anything to disk.
It can also be told to fail. That is what the reliability tests use to reproduce a full disk, a denied folder and a crash part way through a save: set FailAfterOperations to the step to fail at, and every file is left exactly as it was at that moment.
Properties
CountReads
public bool CountReads { get; set; }
Whether reads count towards FailAfterOperations. Off by default, so a crash point lands on a step that changes a file.
FailAfterOperations
public int FailAfterOperations { get; set; }
How many operations to let through before failing, or -1 to never fail. Counting starts at zero, so a value of 0 fails the very first operation.
FailureCode
public SaveErrorCode FailureCode { get; set; }
Which error the injected failure reports.
FileCount
public int FileCount { get; }
How many files the storage holds.
OperationCount
public int OperationCount { get; }
How many counted operations have run since the last reset.
Methods
Clear()
public void Clear();
Removes every file.
ClearFaults()
public void ClearFaults();
Stops injecting failures and sets the operation count back to zero.
Delete(string)
public StorageOutcome Delete(string name);
Deletes a file. Deleting a file that is not there succeeds.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
Returns: What happened.
DescribeLocation()
public string DescribeLocation();
Where this storage keeps its files, in a form safe to show a developer or put in a support email. For file storage this is the folder path.
Returns: A description of the location. Never null.
Exists(string)
public bool Exists(string name);
Whether a file exists.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
Returns: true when the file is there.
GetLastWriteUtc(string)
public DateTime GetLastWriteUtc(string name);
When a file was last written.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
Returns: The time in UTC, or DateTime.MinValue when the file is not there.
GetLength(string)
public long GetLength(string name);
How many bytes a file holds.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
Returns: The length, or zero when the file is not there.
List(string, List<string>)
public StorageOutcome List(string searchPattern, List<string> into);
Lists file names in the storage.
| Parameter | Description |
|---|---|
searchPattern |
A simple pattern such as *.save. Null or empty lists everything. |
into |
The list to fill. It is cleared first. |
Returns: What happened.
MatchesPattern(string, string)
public static bool MatchesPattern(string name, string pattern);
Whether a file name matches a simple pattern of the kind storage listing accepts, which is a literal name with any number of asterisks in it.
| Parameter | Description |
|---|---|
name |
The file name to test. |
pattern |
The pattern. Null or empty matches everything. |
Returns: true when the name matches.
Move(string, string, bool)
public StorageOutcome Move(string fromName, string toName, bool overwrite);
Renames or moves a file inside the storage.
| Parameter | Description |
|---|---|
fromName |
The file to move. |
toName |
Where to move it. |
overwrite |
Whether to replace an existing file at the destination. |
Returns: What happened.
Read(string, byte[])
public StorageOutcome Read(string name, out byte[] data);
Reads a whole file.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
data |
The contents, or null on failure. |
Returns: What happened.
Replace(string, string, string)
public StorageOutcome Replace(string sourceName, string destinationName, string backupName);
Puts one file in place of another in a single step, moving the file being replaced aside as a backup. This is the step that makes a save crash-safe: either the old file or the new one is in place, never half of either.
| Parameter | Description |
|---|---|
sourceName |
The file to put in place. |
destinationName |
The file to replace. It need not exist. |
backupName |
Where to move the file being replaced. Null or empty discards it. |
Returns: What happened.
SetFile(string, byte[])
public void SetFile(string name, byte[] data);
Puts a file straight into the storage, for a test that needs a particular starting point such as a damaged save.
| Parameter | Description |
|---|---|
name |
The file name. |
data |
The contents. Null removes the file. |
Snapshot()
public Dictionary<string, byte[]> Snapshot();
A copy of the whole storage, so a test can record the state of every file before an operation and compare it afterwards.
Returns: A new dictionary holding a copy of every file.
Write(string, byte[])
public StorageOutcome Write(string name, byte[] data);
Writes a whole file and makes sure it has reached the disk before returning, which is what lets the next step verify it and what makes a crash afterwards survivable.
| Parameter | Description |
|---|---|
name |
The file name inside the storage. |
data |
The contents to write. Null is treated as empty. |
Returns: What happened.
StorageOutcome #
struct in RareGeometry.Shipready.Save.Storage · assembly RareGeometry.Shipready.Save
public struct StorageOutcome
What one storage call did.
Fields
Code
public SaveErrorCode Code;
Why it failed, or SaveErrorCode.None.
Error
public string Error;
A plain-English reason, or null on success.
Success
public bool Success;
Whether the call did what it was asked to do.
Methods
Fail(SaveErrorCode, string)
public static StorageOutcome Fail(SaveErrorCode code, string error);
A failed outcome.
| Parameter | Description |
|---|---|
code |
Why it failed. |
error |
A plain-English reason. |
Returns: An outcome whose Success is false.
Ok()
public static StorageOutcome Ok();
A successful outcome.
Returns: An outcome whose Success is true.
Namespace RareGeometry.Shipready.Save.World #
FieldSaver #
static class in RareGeometry.Shipready.Save.World · assembly RareGeometry.Shipready.Save
public static class FieldSaver
The Field Picker saver: saves the Inspector fields ticked on a Saveable. It only accepts fields Unity itself saves (public or [SerializeField], not [NonSerialized], not static, not read-only) of a type Shipready supports:
- numbers, text, true/false, enums and the Unity vector, rotation, colour, rectangle and bounds types;
- classes and structs marked
[Serializable], saved under Unity's own rules; - links to saved objects (a Saveable, its GameObject or one of its components) and to registered assets such as ScriptableObjects and prefabs;
- lists and arrays of any of those.
The Field Picker greys out every other field and shows the reason this class gives.
Methods
IsSupportedField(FieldInfo, string)
public static bool IsSupportedField(FieldInfo field, out string reason);
Whether a field can be ticked in the Field Picker, and if not, why not.
| Parameter | Description |
|---|---|
field |
The field. Null is refused. |
reason |
Why the field cannot be saved, in plain English; null when it can. |
Returns: true when the field can be saved.
IsSupportedType(Type, string)
public static bool IsSupportedType(Type type, out string reason);
Whether a value of a type can be saved by the Field Picker, and if not, why not.
| Parameter | Description |
|---|---|
type |
The field type. Null is refused. |
reason |
Why the type cannot be saved, in plain English; null when it can. |
Returns: true when the type can be saved.
ISceneLoader #
interface in RareGeometry.Shipready.Save.World · assembly RareGeometry.Shipready.Save
public interface ISceneLoader
Loads scenes for Shipready, for a game that starts its scene loads its own way, such as scenes that are not in Build Settings or a load that also shows a loading screen. Set it on SaveWorld.SceneLoader. Left at null, Shipready loads scenes that are in Build Settings with SceneManager.LoadSceneAsync.
Return the AsyncOperation of a SceneManager load, and leave allowSceneActivation on: Shipready waits for the operation to finish, up to SaveWorld.SceneLoadTimeoutSeconds. A game that loads scenes through Addressables loads them itself and uses WorldLoadMode.RestoreIntoCurrentScenes, or calls SaveWorld.ApplyScene(Scene) once each scene is in.
Methods
LoadScene(string, string, LoadSceneMode)
AsyncOperation LoadScene(string scenePath, string sceneName, LoadSceneMode mode);
Starts loading a scene. Return null when it cannot be loaded.
| Parameter | Description |
|---|---|
scenePath |
The scene path, such as Assets/Levels/Town.unity. May be empty when only the name is known. |
sceneName |
The scene name, such as Town. |
mode |
Whether the scene replaces the loaded ones or is added to them. |
Returns: The load in progress, or null.
Namespace RareGeometry.Shipready.Save.World.Registries #
AssetReferences #
static class in RareGeometry.Shipready.Save.World.Registries · assembly RareGeometry.Shipready.Save
public static class AssetReferences
Where Shipready looks up assets while saving and loading. The Asset Registry sets itself here when Shipready starts, and the save writer and reader use whatever is set.
Nothing is registered until a game has an Asset Registry, so a reference written before then is reported rather than written as something that cannot be read back.
Properties
IsAvailable
public static bool IsAvailable { get; }
Whether a registry is available.
Source
public static IAssetReferenceSource Source { get; set; }
The registry Shipready is using. Null until a game sets one up, which the Setup Wizard does and Diagnostics checks.
Methods
GetAsset(string, Type)
public static UnityEngine.Object GetAsset(string id, Type type);
The asset an identifier refers to, or null when it cannot be found.
| Parameter | Description |
|---|---|
id |
The stored identifier. |
type |
The type the caller is expecting. |
Returns: The asset, or null.
GetId(UnityEngine.Object)
public static string GetId(UnityEngine.Object asset);
The stored identifier for an asset, or an empty string when there is no registry or the asset is not in it. Either way the reason is reported once, not swallowed.
| Parameter | Description |
|---|---|
asset |
The asset to identify. |
Returns: The identifier, or an empty string.
AssetRegistry #
class in RareGeometry.Shipready.Save.World.Registries · assembly RareGeometry.Shipready.Save
public sealed class AssetRegistry : ScriptableObject, IAssetReferenceSource
Every asset a save may point at, such as ScriptableObject item definitions, under a permanent id: the asset's Unity GUID. A link to an asset is saved as that id, so a developer can rename or move the asset without breaking a single save.
Shipready asks this registry first and then the Prefab Registry whenever it writes or reads an asset link, through AssetReferences. Point the settings asset at it with SaveKitSettings.AssetRegistry.
Properties
Count
public int Count { get; }
How many assets are registered.
Methods
GetIds(List<string>)
public int GetIds(List<string> into);
The ids of every entry, in the order they were registered.
| Parameter | Description |
|---|---|
into |
The list to fill. It is cleared first. Null does nothing. |
Returns: How many ids were added.
Register(string, UnityEngine.Object)
public void Register(string id, UnityEngine.Object asset);
Registers an asset, replacing any entry with the same id. A null id or asset is ignored.
| Parameter | Description |
|---|---|
id |
The asset id, normally the asset's GUID. |
asset |
The asset. |
RemoveMissing()
public int RemoveMissing();
Drops every entry whose asset no longer exists, or that has no id.
Returns: How many entries were dropped.
TryGetAsset(string, Type, UnityEngine.Object)
public bool TryGetAsset(string id, Type type, out UnityEngine.Object asset);
The asset registered under an id, when it is of the expected type.
| Parameter | Description |
|---|---|
id |
The asset id. |
type |
The type the caller expects. Null accepts any type. |
asset |
The asset, or null. |
Returns: true when the id names an existing asset of that type.
TryGetId(UnityEngine.Object, string)
public bool TryGetId(UnityEngine.Object asset, out string id);
The id an asset is registered under.
| Parameter | Description |
|---|---|
asset |
The asset. Null gives an empty id. |
id |
The id, or an empty string when the asset is not registered. |
Returns: true when the asset is registered.
Unregister(string)
public bool Unregister(string id);
Removes the entry with an id.
| Parameter | Description |
|---|---|
id |
The asset id. |
Returns: true when an entry was removed.
IAssetReferenceSource #
interface in RareGeometry.Shipready.Save.World.Registries · assembly RareGeometry.Shipready.Save
public interface IAssetReferenceSource
Turns an asset into an identifier that survives a save, and back again. The Asset Registry implements it; the save writer and reader only ever talk to this.
Methods
TryGetAsset(string, Type, UnityEngine.Object)
bool TryGetAsset(string id, Type type, out UnityEngine.Object asset);
The asset an identifier refers to.
| Parameter | Description |
|---|---|
id |
The stored identifier. |
type |
The type the caller is expecting. |
asset |
The asset, or null when the identifier is not registered. |
Returns: true when the identifier names a registered asset of that type.
TryGetId(UnityEngine.Object, string)
bool TryGetId(UnityEngine.Object asset, out string id);
The stored identifier for an asset.
| Parameter | Description |
|---|---|
asset |
The asset to identify. Null gives an empty identifier. |
id |
The identifier, or an empty string when the asset is not registered. |
Returns: true when the asset has an identifier.
PrefabRegistry #
class in RareGeometry.Shipready.Save.World.Registries · assembly RareGeometry.Shipready.Save
public sealed class PrefabRegistry : ScriptableObject
Every prefab Shipready can re-create on load, under a permanent id: the prefab asset's Unity GUID. Objects spawned at runtime are saved with their prefab id, and a load finds the prefab here again.
The Editor keeps this list up to date on its own whenever a prefab with a Saveable is imported, so a developer never edits it by hand. Point the settings asset at it with SaveKitSettings.PrefabRegistry.
Properties
Count
public int Count { get; }
How many prefabs are registered.
Methods
GetIds(List<string>)
public int GetIds(List<string> into);
The ids of every entry, in the order they were registered.
| Parameter | Description |
|---|---|
into |
The list to fill. It is cleared first. Null does nothing. |
Returns: How many ids were added.
Register(string, GameObject)
public void Register(string id, GameObject prefab);
Registers a prefab, replacing any entry with the same id. A null id or prefab is ignored.
| Parameter | Description |
|---|---|
id |
The prefab id, normally the prefab asset's GUID. |
prefab |
The prefab asset. |
RemoveMissing()
public int RemoveMissing();
Drops every entry whose prefab no longer exists, or that has no id.
Returns: How many entries were dropped.
TryGetId(GameObject, string)
public bool TryGetId(GameObject prefab, out string id);
The id a prefab is registered under.
| Parameter | Description |
|---|---|
prefab |
The prefab asset. |
id |
The id, or an empty string when the prefab is not registered. |
Returns: true when the prefab is registered.
TryGetPrefab(string, GameObject)
public bool TryGetPrefab(string id, out GameObject prefab);
The prefab registered under an id.
| Parameter | Description |
|---|---|
id |
The prefab id. |
prefab |
The prefab, or null when the id is not registered. |
Returns: true when the id names a prefab that still exists.
Unregister(string)
public bool Unregister(string id);
Removes the entry with an id.
| Parameter | Description |
|---|---|
id |
The prefab id. |
Returns: true when an entry was removed.
SceneRegistry #
class in RareGeometry.Shipready.Save.World.Registries · assembly RareGeometry.Shipready.Save
public sealed class SceneRegistry : ScriptableObject
Every scene Shipready saves, under a permanent id: the scene asset's Unity GUID, with its path as a label. Each scene's section in a save is keyed by that id, so renaming or moving a scene never breaks a save: the Editor updates the path here and the id stays.
A loaded scene is found by its path, or by its name when it has no path (a scene created at runtime). Point the settings asset at it with SaveKitSettings.SceneRegistry.
Properties
Count
public int Count { get; }
How many scenes are registered.
Methods
GetIds(List<string>)
public int GetIds(List<string> into);
The ids of every entry, in the order they were registered.
| Parameter | Description |
|---|---|
into |
The list to fill. It is cleared first. Null does nothing. |
Returns: How many ids were added.
NameFromPath(string)
public static string NameFromPath(string path);
The scene name a path gives: the file name without its extension.
| Parameter | Description |
|---|---|
path |
The scene path. |
Returns: The name, or an empty string for an empty path.
Register(string, string)
public void Register(string id, string path);
Registers a scene, or moves the entry with the same id to a new path. The name is taken from the path. A null or empty id or path is ignored.
| Parameter | Description |
|---|---|
id |
The scene id, normally the scene asset's GUID. |
path |
The scene path. |
TryGetId(Scene, string)
public bool TryGetId(Scene scene, out string id);
The id of a loaded scene: the entry whose path is the scene's path, or, for a scene with no path, the entry whose name is the scene's name.
| Parameter | Description |
|---|---|
scene |
The scene. |
id |
The id, or an empty string when the scene is not registered. |
Returns: true when the scene is registered.
TryGetIdByName(string, string)
public bool TryGetIdByName(string sceneName, out string id);
The id of the scene with a name, for a scene that has no path.
| Parameter | Description |
|---|---|
sceneName |
The scene name, without folder or extension. |
id |
The id, or an empty string when no scene has that name. |
Returns: true when a scene with that name is registered.
TryGetIdByPath(string, string)
public bool TryGetIdByPath(string path, out string id);
The id of the scene at a path.
| Parameter | Description |
|---|---|
path |
The scene path, such as Assets/Levels/Town.unity. |
id |
The id, or an empty string when no scene is registered at that path. |
Returns: true when a scene is registered at that path.
TryGetPath(string, string)
public bool TryGetPath(string id, out string path);
The path of the scene registered under an id.
| Parameter | Description |
|---|---|
id |
The scene id. |
path |
The path, or an empty string when the id is not registered. |
Returns: true when the id is registered.
Unregister(string)
public bool Unregister(string id);
Removes the entry with an id.
| Parameter | Description |
|---|---|
id |
The scene id. |
Returns: true when an entry was removed.
Namespace RareGeometry.Shipready.Save.UI #
ConfirmDialog #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class ConfirmDialog : MonoBehaviour
The yes-or-no question the menu asks before anything that cannot be undone: overwriting a save, loading over unsaved progress, deleting. It covers the menu while it is open, so the mouse cannot reach anything else, and keyboard and gamepad navigation stays between its two buttons. Cancel (Escape, or East on a gamepad) backs out.
The Cancel button is selected when it opens, so pressing Submit twice by accident never confirms something destructive.
Add Component menu: Shipready → Confirm Dialog
Properties
CanAskForName
public bool CanAskForName { get; }
Whether this dialog can ask for a name: it has a name box.
CancelButton
public Button CancelButton { get; }
The button that backs out.
ClosedThisFrame
public bool ClosedThisFrame { get; }
Whether the question closed during this frame, so the key that closed it is not used again.
ConfirmButton
public Button ConfirmButton { get; }
The button that goes ahead.
IsAskingForName
public bool IsAskingForName { get; }
Whether the open question asks for a name.
IsOpen
public bool IsOpen { get; }
Whether the question is showing.
Message
public string Message { get; }
The question being asked, or empty when the dialog is closed.
MessageLabel
public TMP_Text MessageLabel { get; }
The label that shows the question.
NameField
public TMP_InputField NameField { get; }
The box a save's name is typed into, or null when the dialog has none.
Theme
public MenuTheme Theme { get; set; }
The theme the dialog styles its confirm button with. The menu sets it.
Methods
Cancel()
public void Cancel();
Backs out, as the Cancel button does: closes the question and calls the cancel action.
CancelFromInput()
public void CancelFromInput();
Backs out because the player pressed Cancel, at most once per frame. Used when the dialog is not inside a SaveMenu, which otherwise handles Cancel itself.
Confirm()
public void Confirm();
Goes ahead, as the confirm button does: closes the question and calls the confirm action.
Hide()
public void Hide();
Closes the question without calling either action.
Show(string, Action, Action)
public void Show(string message, Action onConfirm, Action onCancel);
Asks a question with the default Confirm and Cancel labels.
| Parameter | Description |
|---|---|
message |
The question. |
onConfirm |
What to do when the player confirms. May be null. |
onCancel |
What to do when the player backs out. May be null. |
Show(string, string, string, bool, Action, Action)
public void Show(string message, string confirmText, string cancelText, bool destructive, Action onConfirm, Action onCancel);
Asks a question.
| Parameter | Description |
|---|---|
message |
The question. |
confirmText |
The confirm button's label, such as Delete. Null keeps the current label. |
cancelText |
The cancel button's label. Null keeps the current label. |
destructive |
Whether going ahead destroys something, which styles the confirm button as a danger. |
onConfirm |
What to do when the player confirms. May be null. |
onCancel |
What to do when the player backs out. May be null. |
ShowWithName(string, string, string, string, string, bool, Action<string>, Action)
public void ShowWithName(string message, string currentName, string placeholder, string confirmText, string cancelText, bool destructive, Action<string> onConfirm, Action onCancel);
Asks a question with a name box under it, such as "Name this save". The box starts with currentName, selected, so typing replaces it and Enter confirms. Without a name box, this asks the question alone and confirms with the current name.
| Parameter | Description |
|---|---|
message |
The question. |
currentName |
What the box starts with. |
placeholder |
The grey hint shown while the box is empty. |
confirmText |
The confirm button's label. Null keeps the current label. |
cancelText |
The cancel button's label. Null keeps the current label. |
destructive |
Whether going ahead replaces something, which styles the confirm button as a danger. |
onConfirm |
Called with the name typed. May be null. |
onCancel |
What to do when the player backs out. May be null. |
DisplayAs #
enum in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public enum DisplayAs
How a message or state shows to the player: in words, as an icon, both, or not at all. The same choice is offered for every message Shipready shows: the saving indicator, the save notes, the menu's status line and co-op line, and the slot card badges.
Values
GameMenu #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class GameMenu : MonoBehaviour
A title screen or pause menu that needs no code: Continue (the newest save of any kind, greyed out when there is none), New Game, Save Game and Load Game (they open your SaveMenu), Delete All Saves and Quit. Drop GameMenu.prefab into a scene, drag your save menu into its Save Menu field, and tick the buttons you want.
It asks before anything that loses play: Quit and New Game ask "without saving?" when there is unsaved progress (SaveKit.HasUnsavedProgress), and Delete All Saves always asks. It uses the same MenuTheme and MenuText as the save menu, so every colour, size and word is yours to change, and each button can be switched off.
Add Component menu: Shipready → Game Menu
Properties
AskBeforeNewGame
public bool AskBeforeNewGame { get; set; }
Whether New Game asks first when there is unsaved progress. On by default.
AskBeforeQuitting
public bool AskBeforeQuitting { get; set; }
Whether Quit asks first when there is unsaved progress. On by default.
CloseKey
public KeyCode CloseKey { get; set; }
The key that backs out: it closes the menu's question first, then the menu itself when the menu has a ToggleKey (a pause menu; a title screen stays open). Escape by default.
CloseWhenPlaying
public bool CloseWhenPlaying { get; set; }
Whether the menu hides once Continue, New Game or a load from the save menu has started the game. On by default.
CloseWithGamepad
public bool CloseWithGamepad { get; set; }
Whether the gamepad's back button (B, Circle) backs out too. On by default.
ContinueButton
public Button ContinueButton { get; }
The Continue button.
ContinueScene
public string ContinueScene { get; set; }
The scene loaded before Continue loads. Empty loads straight away.
Dialog
public ConfirmDialog Dialog { get; }
The question the menu asks before Quit, New Game and Delete All Saves.
IsBusy
public bool IsBusy { get; }
Whether Continue, New Game or Quit is still working.
IsOpen
public bool IsOpen { get; }
Whether the menu is showing.
LoadGameButton
public Button LoadGameButton { get; }
The Load Game button.
NewGameButton
public Button NewGameButton { get; }
The New Game button.
NewGameScene
public string NewGameScene { get; set; }
The scene New Game loads. Empty starts the new game in the open scene.
OnClosed
public UnityEvent OnClosed { get; }
Raised when the menu closes.
OnContinued
public UnityEvent OnContinued { get; }
Raised when Continue has loaded the newest save.
OnFailed
public UnityEvent OnFailed { get; }
Raised when an action failed, such as Continue with a save that could not be loaded.
OnNewGame
public UnityEvent OnNewGame { get; }
Raised when New Game has started a new game.
OnOpened
public UnityEvent OnOpened { get; }
Raised when the menu opens.
OnQuitting
public UnityEvent OnQuitting { get; }
Raised just before Quit quits the game or loads the quit scene.
OnReset
public UnityEvent OnReset { get; }
Raised when Delete All Saves has deleted the saves.
OpenOnStart
public bool OpenOnStart { get; set; }
Whether the menu shows when the scene starts. Set it before the menu's Start runs.
Placement
public MenuPlacement Placement { get; set; }
Where the buttons sit on the screen.
QuitButton
public Button QuitButton { get; }
The Quit button.
QuitScene
public string QuitScene { get; set; }
The scene Quit loads. Empty quits the game.
ResetProgressButton
public Button ResetProgressButton { get; }
The Delete All Saves button.
SaveGameButton
public Button SaveGameButton { get; }
The Save Game button.
SaveMenu
public SaveMenu SaveMenu { get; set; }
The save menu Save Game and Load Game open.
ShowContinue
public bool ShowContinue { get; set; }
Whether Continue shows.
ShowLoadGame
public bool ShowLoadGame { get; set; }
Whether Load Game shows.
ShowNewGame
public bool ShowNewGame { get; set; }
Whether New Game shows.
ShowQuit
public bool ShowQuit { get; set; }
Whether Quit shows.
ShowResetProgress
public bool ShowResetProgress { get; set; }
Whether Delete All Saves shows.
ShowSaveGame
public bool ShowSaveGame { get; set; }
Whether Save Game shows.
Text
public MenuText Text { get; set; }
The words. Null uses the defaults. Applies at once.
Theme
public MenuTheme Theme { get; set; }
The look: the same theme asset as the save menu. Null uses the defaults. Applies at once.
ToggleKey
public KeyCode ToggleKey { get; set; }
A key that opens and closes the menu. None by default.
Methods
Close()
public void Close();
Hides the menu, and any question it was asking.
Continue()
public void Continue();
Loads the newest save of every kind, as Continue does.
LoadGame()
public void LoadGame();
Opens the save menu to load, as Load Game does.
NewGame()
public void NewGame();
Starts a new game, asking first when there is unsaved progress, as New Game does.
Open()
public void Open();
Shows the menu and selects its first button.
Quit()
public void Quit();
Quits, asking "without saving?" first when there is unsaved progress, as Quit does.
Refresh()
public void Refresh();
Greys Continue out when there is nothing to continue, and in again when there is.
ResetProgress()
public void ResetProgress();
Deletes every save after asking, as Delete All Saves does.
SaveGame()
public void SaveGame();
Opens the save menu to save, as Save Game does.
Toggle()
public void Toggle();
Opens the menu when it is closed, and closes it when it is open.
HotkeysActiveIn #
enum in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public enum HotkeysActiveIn
Where the test hotkeys of SaveMenuHotkeys work.
Values
| Name | Value | Description |
|---|---|---|
EditorOnly |
0 |
Only in the Editor's Play Mode. A built game ignores the keys. The default. |
EditorAndBuilds |
1 |
In the Editor and in built games. |
Off |
2 |
Nowhere: the keys do nothing. |
IndicatorCorner #
enum in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public enum IndicatorCorner
Which corner of the screen the SavingIndicator sits in.
Values
| Name | Value | Description |
|---|---|---|
BottomRight |
0 |
Bottom right, where most games put it. The default. |
BottomLeft |
1 |
Bottom left. |
TopRight |
2 |
Top right. |
TopLeft |
3 |
Top left. |
ISaveMenuConfirmation #
interface in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public interface ISaveMenuConfirmation
Your own confirmation for the save menu's questions ("Overwrite Slot 2?", "Load Slot 1?", "Delete Slot 3?"), in place of Shipready's ConfirmDialog. Put it on a component and drag that component into the menu's Confirmation field, or set SaveMenu.Confirmation in code.
Show the question your way, then call exactly one of the two callbacks when the player answers. The menu waits until then; it does not time out.
Properties
IsOpen
bool IsOpen { get; }
Whether the question is showing, so Cancel on the menu goes to it first.
Methods
Ask(string, string, string, bool, Action, Action)
void Ask(string question, string confirmLabel, string cancelLabel, bool destructive, Action confirmed, Action cancelled);
Asks the player a question.
| Parameter | Description |
|---|---|
question |
The question, already filled in, such as "Delete Slot 3? This cannot be undone." |
confirmLabel |
The menu's word for yes, such as "Delete". |
cancelLabel |
The menu's word for no, such as "Cancel". |
destructive |
Whether yes loses something (overwrite, delete), so it can look like a warning. |
confirmed |
Call when the player says yes. |
cancelled |
Call when the player says no or backs out. |
Cancel()
void Cancel();
Closes the question as if the player said no. The menu calls it when Cancel is pressed.
ISaveMenuNamePrompt #
interface in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public interface ISaveMenuNamePrompt
Your own name box for the save menu's player-named saves and Rename, beside your own ISaveMenuConfirmation. Implement it on the same component: when the menu's Confirmation has it, the menu asks for names through it; when it does not, the menu uses its own dialog's name box for names.
Methods
AskForName(string, string, string, string, string, bool, Action<string>, Action)
void AskForName(string question, string currentName, string placeholder, string confirmLabel, string cancelLabel, bool destructive, Action<string> confirmed, Action cancelled);
Asks the player for a save's name.
| Parameter | Description |
|---|---|
question |
The question, already filled in, such as "Name this save". |
currentName |
The name to start from. |
placeholder |
The hint for an empty box, such as "Enter a name". |
confirmLabel |
The menu's word for yes, such as "Save". |
cancelLabel |
The menu's word for no. |
destructive |
Whether yes replaces a save, so it can look like a warning. |
confirmed |
Call with the name when the player says yes. The menu tidies it (trims it, cuts it to length). |
cancelled |
Call when the player backs out. |
MenuCancelRelay #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class MenuCancelRelay : MonoBehaviour, ICancelHandler
Passes Cancel (Escape, or East on a gamepad) from the EventSystem to the menu. An input module sends Cancel only to the selected object, whichever input system drives it, so every selectable in the menu carries one of these. The menu then closes the open confirmation, or else itself, at most once per frame.
The generated prefabs already have it on every button; the menu also adds it at runtime to any selectable that lacks it, such as a button added in a prefab variant.
Add Component menu: Shipready → Menu Cancel Relay
Methods
OnCancel(BaseEventData)
public void OnCancel(BaseEventData eventData);
Called by the EventSystem when Cancel is pressed while this object is selected.
| Parameter | Description |
|---|---|
eventData |
The event. |
MenuInputBridge #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class MenuInputBridge
Reads the few keys the menu needs outside the EventSystem, from whichever input system the project uses: the old Input Manager, the Input System package, or both. The menu's buttons are driven by the EventSystem's input module; this covers Cancel when nothing is selected and the optional hotkeys of SaveMenuHotkeys.
The Input System is read only when the package is installed and is an active input handler (Player Settings, Active Input Handling); the Input Manager only when it is an active handler. Nothing here is static, so every menu has its own bridge.
Properties
CancelKey
public KeyCode CancelKey { get; set; }
The keyboard key that cancels. Escape by default; KeyCode.None for no key.
CancelWithGamepad
public bool CancelWithGamepad { get; set; }
Whether the gamepad's East button (B, Circle) cancels too. On by default.
Methods
WasCancelPressedThisFrame()
public bool WasCancelPressedThisFrame();
Whether Cancel was pressed this frame: Escape on a keyboard, or East (B on an Xbox pad, Circle on a PlayStation pad) on a gamepad.
Returns: true in the frame Cancel went down.
WasKeyPressedThisFrame(KeyCode)
public bool WasKeyPressedThisFrame(KeyCode key);
Whether a key went down this frame.
| Parameter | Description |
|---|---|
key |
The key. Under the Input System, letters, digits, function keys, the keypad digits and the common editing keys are recognised. |
Returns: true in the frame the key went down.
MenuLayout #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class MenuLayout
How the save menu is laid out: a list or a grid of cards, how tall a card is, which details a card shows, where the panel sits and how wide it is, and whether the title and the dimmed backdrop show. It lives on the MenuTheme (MenuTheme.Layout), so one theme asset carries the whole look, and Tools > Shipready > Menu Style edits it without opening a prefab.
The defaults are the menu's original look: one column of 184-pixel cards with every detail showing, a 1440-pixel panel in the middle, the title and the backdrop on. Sizes are in pixels at the 1920×1080 reference resolution.
Properties
ButtonFadeSeconds
public float ButtonFadeSeconds { get; set; }
How long a button's colour change takes, from 0 (at once) to MaximumFadeSeconds. 0.08 by default.
CardHeight
public float CardHeight { get; set; }
How tall a list card is, from MinimumCardHeight to MaximumCardHeight.
Columns
public int Columns { get; set; }
How many columns of cards: 1 is the list, 2 to 4 a grid of tiles.
DimBackground
public bool DimBackground { get; set; }
Whether the game behind the menu is dimmed.
EffectiveWidth
public float EffectiveWidth { get; }
The width the panel really gets: Width, but at least MinimumListWidth for a list.
FadeInSeconds
public float FadeInSeconds { get; set; }
How long the menu fades in when it opens, from 0 (at once, the default) to MaximumFadeSeconds.
IsDefault
public bool IsDefault { get; }
Whether every value is the default, which is the menu's original look.
IsGrid
public bool IsGrid { get; }
Whether the cards are laid out as a grid of tiles rather than a list.
NewestFirst
public bool NewestFirst { get; set; }
Whether the saves are listed newest first, in both modes. Empty slots follow the saves. Off by default: slot order, with the autosaves and the quicksave first in Load mode.
Placement
public MenuPlacement Placement { get; set; }
Where the panel sits on the screen.
Portrait
public PortraitLayout Portrait { get; set; }
How the menus lay out on a screen held upright. Auto by default: a phone layout.
PortraitWidth
public float PortraitWidth { get; set; }
For PortraitLayout.Custom: how wide the phone layout is drawn, from MinimumPortraitWidth to MaximumPortraitWidth.
ShowBadges
public bool ShowBadges { get; set; }
Whether a card shows its badges.
ShowDate
public bool ShowDate { get; set; }
Whether a card shows when the save was made.
ShowGameMenuSubtitle
public bool ShowGameMenuSubtitle { get; set; }
Whether the Game Menu shows the line under its title, when the menu text gives one. On by default.
ShowGameMenuTitle
public bool ShowGameMenuTitle { get; set; }
Whether the Game Menu shows its title: the game's name unless the menu text gives one. On by default.
ShowLocation
public bool ShowLocation { get; set; }
Whether a card shows where the player was.
ShowPlaytime
public bool ShowPlaytime { get; set; }
Whether a card shows the playtime.
ShowStatus
public bool ShowStatus { get; set; }
Whether the status line under the list shows, such as "Saved to Slot 1." On by default.
ShowSummary
public bool ShowSummary { get; set; }
Whether a card shows the game's two summary lines.
ShowTabs
public bool ShowTabs { get; set; }
Whether the Load menu shows the All, Saves and Autosaves tabs, which pick what the list shows. Off by default. The tabs only show when there is more than one kind of save to pick from: autosaves or the quicksave are listed in Load mode.
ShowThumbnail
public bool ShowThumbnail { get; set; }
Whether a card shows the save's picture.
ShowTitle
public bool ShowTitle { get; set; }
Whether the title, the subtitle and the accent bar show.
UsesTiles
public bool UsesTiles { get; }
Whether the cards are tiles (picture on top, buttons at the bottom): a grid, or one column of them on a phone.
Width
public float Width { get; set; }
How wide the panel is, from MinimumWidth to MaximumWidth.
Constants
DefaultButtonFadeSeconds
public const float DefaultButtonFadeSeconds = 0.08f;
How long a button's colour change takes when the layout is left as it is.
DefaultCardHeight
public const float DefaultCardHeight = 184f;
A list card's height when the layout is left as it is.
DefaultWidth
public const float DefaultWidth = 1440f;
The panel's width when the layout is left as it is.
MaximumCardHeight
public const float MaximumCardHeight = 320f;
The tallest list card.
MaximumColumns
public const int MaximumColumns = 4;
The most columns a grid can have.
MaximumFadeSeconds
public const float MaximumFadeSeconds = 1f;
The longest fade-in.
MaximumPortraitWidth
public const float MinimumPortraitWidth = 600f, MaximumPortraitWidth = 1080f;
The narrowest and widest phone layout, in canvas units, for PortraitLayout.Custom.
MaximumWidth
public const float MaximumWidth = 1800f;
The widest panel.
MinimumCardHeight
public const float MinimumCardHeight = 140f;
The shortest list card: room for the buttons and the name.
MinimumColumns
public const int MinimumColumns = 1;
The fewest columns: one column is the list.
MinimumListWidth
public const float MinimumListWidth = 1200f;
The narrowest panel a list can use: a list card needs room for its picture, its text and its buttons side by side. A narrower width is used only by a grid.
MinimumPortraitWidth
public const float MinimumPortraitWidth = 600f, MaximumPortraitWidth = 1080f;
The narrowest and widest phone layout, in canvas units, for PortraitLayout.Custom.
MinimumWidth
public const float MinimumWidth = 900f;
The narrowest panel.
Methods
CopyFrom(MenuLayout)
public void CopyFrom(MenuLayout other);
Copies every value from another layout.
| Parameter | Description |
|---|---|
other |
The layout to copy. Null resets to the defaults. |
ForPortrait()
public MenuLayout ForPortrait();
A copy of this layout for a screen held upright: one column of tiles, every other choice kept.
Returns: The copy.
Reset()
public void Reset();
Puts every value back to the default, the menu's original look.
MenuPlacement #
enum in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public enum MenuPlacement
Where the save menu's panel sits on the screen.
Values
| Name | Value | Description |
|---|---|---|
Centre |
0 |
In the middle of the screen. The default. |
Left |
1 |
Against the left edge. |
Right |
2 |
Against the right edge. |
MenuText #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class MenuText : ScriptableObject
Every word the save menu shows, in one asset, so translating the menu needs no extra package: duplicate DefaultMenuText, translate the copy and assign it to the menu (SaveMenu.Text), or swap assets when the player changes language.
Lines with {0} are formatted with string.Format: {0} is the slot's name in the questions, the date in RestoredFromBackupStatus, and so on, as each field says. Dates use DateFormat in the culture DateCultureName names (invariant by default).
Create menu: Assets → Create → Shipready → Menu Text
Properties
AutosaveBadge
public string AutosaveBadge { get; set; }
The Autosave badge.
AutosaveName
public string AutosaveName { get; set; }
The name of an autosave with no name of its own.
BackupRestoredStatus
public string BackupRestoredStatus { get; set; }
Shown after Restore backup. {0} is the save's name.
CancelButton
public string CancelButton { get; set; }
The button that backs out of a confirmation.
CloseButton
public string CloseButton { get; set; }
The button that closes the menu.
ContinueButton
public string ContinueButton { get; set; }
The Game Menu's Continue button.
CopiedStatus
public string CopiedStatus { get; set; }
Shown after Copy. {0} is the name of the slot the copy went into.
CopyButton
public string CopyButton { get; set; }
A saved card's Copy button, shown when copying is on.
CopyFailedStatus
public string CopyFailedStatus { get; set; }
Shown when a copy failed. {0} is the error identifier.
DamagedBackupReady
public string DamagedBackupReady { get; set; }
The line on a damaged save's card when a backup can replace it.
DamagedBadge
public string DamagedBadge { get; set; }
The Damaged badge.
DamagedLoadsBackup
public string DamagedLoadsBackup { get; set; }
The line on a damaged save's card when Load loads its newest backup by itself (Automatic Fallback on), so the card offers Load rather than Restore.
DamagedNoBackup
public string DamagedNoBackup { get; set; }
The line on a damaged save's card when no backup can replace it.
DamagedReason
public string DamagedReason { get; set; }
The line on a damaged save's card that says what is wrong.
DamagedSaveName
public string DamagedSaveName { get; set; }
The name of a damaged save that no copy could name.
DateCulture
public CultureInfo DateCulture { get; }
The culture dates are written in: DateCultureName, or the invariant culture.
DateCultureName
public string DateCultureName { get; set; }
The culture dates are written in, as a .NET culture name such as de-DE or fr-FR, which decides the month and day names DateFormat produces. Empty, the default, uses the invariant culture: English month names and the same result on every machine. A name the platform does not know falls back to invariant.
DateFormat
public string DateFormat { get; set; }
How dates are written: a .NET date format such as d MMM yyyy HH:mm, applied to the local time in the culture DateCultureName names.
DeleteButton
public string DeleteButton { get; set; }
A card's Delete button.
DeleteConfirm
public string DeleteConfirm { get; set; }
The confirm button when deleting.
DeletedStatus
public string DeletedStatus { get; set; }
Shown after a delete. {0} is the save's name.
DeleteFailedStatus
public string DeleteFailedStatus { get; set; }
Shown when a delete failed. {0} is the error identifier.
DeleteQuestion
public string DeleteQuestion { get; set; }
Asked before deleting. {0} is the save's name.
EmptyLoadHint
public string EmptyLoadHint { get; set; }
The second line of an empty slot in the Load menu.
EmptySlot
public string EmptySlot { get; set; }
Shown on a card with no save.
EmptySlotHint
public string EmptySlotHint { get; set; }
The second line on an empty card in Save mode.
GameMenuSubtitle
public string GameMenuSubtitle { get; set; }
The line under the Game Menu's title. Empty shows none.
GameMenuTitle
public string GameMenuTitle { get; set; }
The Game Menu's title, such as the game's name or Paused. Empty hides it.
HostOnlyLine
public string HostOnlyLine { get; set; }
Shown to a co-op client, who cannot save or load.
IndicatorFailed
public string IndicatorFailed { get; set; }
The saving indicator after a save failed.
IndicatorSaved
public string IndicatorSaved { get; set; }
The saving indicator after a save worked.
IndicatorSaving
public string IndicatorSaving { get; set; }
The saving indicator while a save runs.
LoadButton
public string LoadButton { get; set; }
A card's Load button.
LoadConfirm
public string LoadConfirm { get; set; }
The confirm button when loading.
LoadedStatus
public string LoadedStatus { get; set; }
Shown after a load. {0} is the save's name.
LoadFailedStatus
public string LoadFailedStatus { get; set; }
Shown when a load failed. {0} is the error identifier.
LoadGameButton
public string LoadGameButton { get; set; }
The Game Menu's button that opens the save menu to load.
LoadingStatus
public string LoadingStatus { get; set; }
Shown while loading.
LoadQuestion
public string LoadQuestion { get; set; }
Asked before loading, when SaveMenu.ConfirmLoad is on. {0} is the save's name.
LoadSubtitle
public string LoadSubtitle { get; set; }
The line under the title in Load mode.
LoadTitle
public string LoadTitle { get; set; }
The title in Load mode.
NameConfirm
public string NameConfirm { get; set; }
The confirm button of the name box.
NameOverwriteQuestion
public string NameOverwriteQuestion { get; set; }
Asked when saving over a save with player-named saves on. {0} is the save's name.
NamePlaceholder
public string NamePlaceholder { get; set; }
Shown greyed in the empty name box.
NameQuestion
public string NameQuestion { get; set; }
Asked when saving into an empty slot with player-named saves on.
NewerBadge
public string NewerBadge { get; set; }
The From a newer version badge.
NewerVersionStatus
public string NewerVersionStatus { get; set; }
Shown when a save from a newer version of the game is chosen in Load mode.
NewGameButton
public string NewGameButton { get; set; }
The Game Menu's New Game button.
NewGameConfirm
public string NewGameConfirm { get; set; }
The confirm button when starting a new game.
NewGameQuestion
public string NewGameQuestion { get; set; }
Asked before New Game with unsaved progress.
NewSaveGlyph
public string NewSaveGlyph { get; set; }
The symbol in the picture frame of an empty card in Save mode.
NoEmptySlotStatus
public string NoEmptySlotStatus { get; set; }
Shown when Copy is pressed and every slot is used.
NoSavesStatus
public string NoSavesStatus { get; set; }
Shown in Load mode when there is nothing to load.
NoteLoaded
public string NoteLoaded { get; set; }
A save note when a load worked.
NoteLoadFailed
public string NoteLoadFailed { get; set; }
A save note when a load did not work.
NoteRestored
public string NoteRestored { get; set; }
A save note when a save came back from its backup.
NoteSaved
public string NoteSaved { get; set; }
A save note when a save worked; shown only when the notes are set to show saves.
NoteSaveFailed
public string NoteSaveFailed { get; set; }
A save note when a save did not work.
NoThumbnail
public string NoThumbnail { get; set; }
Shown in the picture frame of a save that has no thumbnail.
NotReadyStatus
public string NotReadyStatus { get; set; }
Shown when Shipready has not been started.
OverwriteConfirm
public string OverwriteConfirm { get; set; }
The confirm button when overwriting a save.
OverwriteDamagedQuestion
public string OverwriteDamagedQuestion { get; set; }
Asked before overwriting a damaged save. {0} is the save's name.
OverwriteNewerQuestion
public string OverwriteNewerQuestion { get; set; }
Asked before overwriting a save from a newer version of the game. {0} is the save's name.
OverwriteQuestion
public string OverwriteQuestion { get; set; }
Asked before overwriting a save. {0} is the save's name.
PlaytimeFormat
public string PlaytimeFormat { get; set; }
How playtime is shown. {0} is the playtime as h:mm:ss.
QuicksaveBadge
public string QuicksaveBadge { get; set; }
The badge on the quicksave card.
QuicksaveName
public string QuicksaveName { get; set; }
The name of the quicksave when it has no name of its own.
QuitButton
public string QuitButton { get; set; }
The Game Menu's Quit button.
QuitConfirm
public string QuitConfirm { get; set; }
The confirm button when quitting.
QuitQuestion
public string QuitQuestion { get; set; }
Asked before quitting with unsaved progress.
RenameButton
public string RenameButton { get; set; }
A saved card's Rename button, shown when player-named saves are on.
RenameConfirm
public string RenameConfirm { get; set; }
The confirm button when renaming.
RenamedStatus
public string RenamedStatus { get; set; }
Shown after a rename. {0} is the new name.
RenameFailedStatus
public string RenameFailedStatus { get; set; }
Shown when a rename failed. {0} is the error identifier.
RenameQuestion
public string RenameQuestion { get; set; }
Asked when Rename is pressed. {0} is the save's name.
ResetConfirm
public string ResetConfirm { get; set; }
The confirm button when deleting every save.
ResetProgressButton
public string ResetProgressButton { get; set; }
The Game Menu's reset progress button.
ResetQuestion
public string ResetQuestion { get; set; }
Asked before Delete All Saves.
RestoreButton
public string RestoreButton { get; set; }
A damaged card's Restore backup button.
RestoreConfirm
public string RestoreConfirm { get; set; }
The confirm button when restoring a backup.
RestoredBadge
public string RestoredBadge { get; set; }
The Restored badge: the card shows a backup copy.
RestoredFromBackupStatus
public string RestoredFromBackupStatus { get; set; }
Shown when a damaged save loaded from its backup. {0} is when the backup was saved, in local time, written with DateFormat.
RestoreFailedStatus
public string RestoreFailedStatus { get; set; }
Shown when Restore backup failed. {0} is the error identifier.
RestoreQuestion
public string RestoreQuestion { get; set; }
Asked before restoring a backup, when the menu asks. {0} is the save's name.
RestoringStatus
public string RestoringStatus { get; set; }
Shown while a backup is being restored.
SaveButton
public string SaveButton { get; set; }
A card's Save button.
SavedStatus
public string SavedStatus { get; set; }
Shown after a save. {0} is the save's name.
SaveFailedStatus
public string SaveFailedStatus { get; set; }
Shown when a save failed. {0} is the error identifier, such as SK110.
SaveGameButton
public string SaveGameButton { get; set; }
The Game Menu's button that opens the save menu to save.
SaveSubtitle
public string SaveSubtitle { get; set; }
The line under the title in Save mode.
SaveTitle
public string SaveTitle { get; set; }
The title in Save mode.
SavingStatus
public string SavingStatus { get; set; }
Shown while saving.
SlotName
public string SlotName { get; set; }
The name of a manual slot with no name of its own. {0} is the slot number.
TabAll
public string TabAll { get; set; }
The Load menu tab that shows every save.
TabAutosaves
public string TabAutosaves { get; set; }
The Load menu tab that shows only the autosaves and the quicksave.
TabManual
public string TabManual { get; set; }
The Load menu tab that shows only the player's own saves.
Methods
SetShortWords(MessageKind, string)
public void SetShortWords(MessageKind kind, string words);
Changes the short words of a kind of message. Other news has none, so it is ignored.
| Parameter | Description |
|---|---|
kind |
The kind of message. |
words |
The new words. |
ShortWords(MessageKind)
public string ShortWords(MessageKind kind);
The word or two a kind of message shows as Short text, or as Icon and short text, such as "Saved" or "Newer". Other news (MessageKind.Info) has no short words and shows its whole sentence.
| Parameter | Description |
|---|---|
kind |
The kind of message. |
Returns: The short words, or empty for other news.
MenuTheme #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class MenuTheme : ScriptableObject
How the save menu looks: every colour, the font, the font sizes, the corner radius and the spacing, in one asset. Change a value here and every panel, card, button and badge follows, because each of them carries a ThemedElement that reads it.
The easy way to restyle is Tools > Shipready > Menu Style: pick one of six ready-made styles, change any colour, size or the layout (Layout), and see it at once. It works on a copy in your data folder, never on Shipready's own assets. By hand: duplicate DefaultMenuTheme, change the copy and assign it to the menu (SaveMenu.Theme). For changes the theme cannot express, edit a prefab variant of SaveMenu.prefab, or build your own menu on the public API.
Create menu: Assets → Create → Shipready → Menu Theme
Properties
Accent
public Color Accent { get; set; }
The highlight colour: the selected button, the selection outline, the title bar.
AccentText
public Color AccentText { get; set; }
Text on an accent or danger background, such as a selected button.
Backdrop
public Color Backdrop { get; set; }
The full-screen dimming behind the menu.
BadgeAutosave
public Color BadgeAutosave { get; set; }
The Autosave and Quicksave badge.
BadgeDamaged
public Color BadgeDamaged { get; set; }
The Damaged badge.
BadgeNewer
public Color BadgeNewer { get; set; }
The From a newer version badge.
BadgeRestored
public Color BadgeRestored { get; set; }
The Restored badge.
BadgeSize
public float BadgeSize { get; set; }
Badge labels.
BadgeText
public Color BadgeText { get; set; }
Text on a badge.
BodySize
public float BodySize { get; set; }
Normal text, such as the location and the status line.
Button
public Color Button { get; set; }
A button at rest.
ButtonDisabled
public Color ButtonDisabled { get; set; }
A button that cannot be used right now.
ButtonHover
public Color ButtonHover { get; set; }
A button under the mouse.
ButtonImage
public Sprite ButtonImage { get; set; }
Your own picture behind every plain and Delete button, tinted by the button colours (make them white to show it as drawn). Null uses the rounded shape. A sprite with borders set in the Sprite Editor is 9-sliced, so its corners keep their shape at any size.
ButtonPressed
public Color ButtonPressed { get; set; }
A button being pressed.
ButtonSize
public float ButtonSize { get; set; }
Button labels.
Card
public Color Card { get; set; }
A slot card.
CardEmpty
public Color CardEmpty { get; set; }
A slot card that cannot be used, such as an empty slot in the Load menu.
CardImage
public Sprite CardImage { get; set; }
Your own picture behind each slot card, tinted by the card colours. Null uses the rounded shape.
CardSelected
public Color CardSelected { get; set; }
The slot card that holds the keyboard or gamepad selection.
CardSpacing
public float CardSpacing { get; set; }
The gap between two slot cards.
CornerRadius
public int CornerRadius { get; set; }
How round the corners are, from 0 (square) to MaximumCornerRadius.
Danger
public Color Danger { get; set; }
Destructive actions: the Delete button text and a destructive confirmation.
Dialog
public Color Dialog { get; set; }
The confirmation box.
DialogShade
public Color DialogShade { get; set; }
The dimming behind a confirmation.
DialogSize
public float DialogSize { get; set; }
The question in a confirmation.
Divider
public Color Divider { get; set; }
Thin lines that separate the header and footer from the list.
Font
public TMP_FontAsset Font { get; set; }
The TextMesh Pro font for every label. Null keeps TextMesh Pro's default font.
HeadingSize
public float HeadingSize { get; set; }
A slot card's name.
Layout
public MenuLayout Layout { get; }
How the menu is laid out: list or grid, card height, which details a card shows, where the panel sits and how wide it is, the title and the backdrop. Never null; the defaults are the menu's original look.
Messages
public MessageLook Messages { get; }
How Shipready's messages show: the display of the saving indicator, the save notes, the status line and the badges, where the indicator and the notes sit, and each state's colour and icon. Never null; the defaults are Shipready's original look.
MutedText
public Color MutedText { get; set; }
Secondary text, such as dates and summaries.
Panel
public Color Panel { get; set; }
The menu panel.
PanelImage
public Sprite PanelImage { get; set; }
Your own picture behind the menu panel and the confirmation box, tinted by their colours. Null uses the rounded shape.
PrimaryButton
public Color PrimaryButton { get; set; }
The main action of a card at rest: Save or Load.
PrimaryButtonImage
public Sprite PrimaryButtonImage { get; set; }
Your own picture behind the main button of a card or a confirmation. Null uses ButtonImage, or the rounded shape.
ScrollHandle
public Color ScrollHandle { get; set; }
The scrollbar handle.
ScrollTrack
public Color ScrollTrack { get; set; }
The scrollbar track.
SelectionOutline
public int SelectionOutline { get; set; }
The thickness of the outline around the selected card, from 1 to 8.
SmallSize
public float SmallSize { get; set; }
Secondary text, such as the date, playtime and summaries.
Text
public Color Text { get; set; }
Normal text.
ThumbnailBackground
public Color ThumbnailBackground { get; set; }
The frame behind a thumbnail, and the placeholder when there is none.
TitleSize
public float TitleSize { get; set; }
The menu title.
Warning
public Color Warning { get; set; }
Notices such as the host-only line.
Constants
MaximumCornerRadius
public const int MaximumCornerRadius = 48;
The largest corner radius the theme allows, in pixels at 1920×1080.
Methods
ContextColour(MessageKind)
public Color ContextColour(MessageKind kind);
The colour that tells a kind of message apart: green for saved, red for damaged or a failure, amber for restored, and so on. The badge kinds use the badge colours, so a badge and its icon always match.
| Parameter | Description |
|---|---|
kind |
The kind of message. |
Returns: Its colour.
IconFor(MessageKind)
public Sprite IconFor(MessageKind kind);
A kind of message's icon: the theme's own when it has one, otherwise Shipready's built-in icon.
| Parameter | Description |
|---|---|
kind |
The kind of message. |
Returns: The sprite. Never null.
ImageFor(MenuThemeRole)
public Sprite ImageFor(MenuThemeRole role);
The picture this theme puts behind a kind of surface instead of the rounded shape.
| Parameter | Description |
|---|---|
role |
The surface. |
Returns: The sprite, or null when the surface uses the rounded shape.
RadiusFor(MenuThemeRole)
public int RadiusFor(MenuThemeRole role);
The corner radius for a kind of surface: panels and dialogs use the full radius, cards three quarters of it and buttons half, so nested shapes look concentric.
| Parameter | Description |
|---|---|
role |
The surface. |
Returns: The radius in pixels, 0 for a square corner.
MenuThemeRole #
enum in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public enum MenuThemeRole
What a piece of the menu is, which decides the colours, font size and shape the theme gives it.
Values
MessageIcons #
static class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public static class MessageIcons
Shipready's built-in icons, one for each MessageKind: a spinner for saving and loading, a tick for saved, a document with a crack for damaged, a padlock, two people for co-op, and so on. They are drawn from exact shapes when first asked for, so Shipready ships no image files: every line has the same weight and smooth edges, the shape sits exactly in the middle of its square, and the big texture with its smaller copies stays crisp from a small badge up to a 4K screen.
Each icon is white on a clear background, so an Image's colour tints it. A theme can replace any of them (MessageKindLook.Icon). The cache is cleared when a play session starts, so it is correct with domain reload switched off.
Constants
Size
public const int Size = 128;
The size of each icon's texture, in pixels.
Methods
Get(MessageKind)
public static Sprite Get(MessageKind kind);
The built-in icon for a kind of message. Made once, then cached.
| Parameter | Description |
|---|---|
kind |
The kind. |
Returns: The sprite. Never null.
MessageKind #
enum in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public enum MessageKind
The kinds of message Shipready shows the player. Each has its own colour and icon in the theme (MenuTheme.ContextColour(MessageKind), MenuTheme.IconFor(MessageKind)) and its own short words in the menu text (MenuText.ShortWords(MessageKind)).
Values
MessageKindLook #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class MessageKindLook
One kind of message's own settings in a theme: its icon (empty uses Shipready's built-in icon) and, when ticked, a display of its own that every part of Shipready uses for it.
Properties
Display
public DisplayAs Display { get; set; }
How this kind of message shows when OwnDisplay is on.
Icon
public Sprite Icon { get; set; }
The icon. Null uses Shipready's built-in icon.
OwnDisplay
public bool OwnDisplay { get; set; }
Whether this kind of message uses Display everywhere.
MessageLook #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class MessageLook
How Shipready's messages look, on the MenuTheme (MenuTheme.Messages): how each part shows its messages (DisplayAs), where the saving indicator and the save notes sit, the colour of each state and each kind's icon. Set it once in the theme; the indicator, the notes and the menu can each choose their own on top.
The colours of the Autosave, Damaged, Restored and From a newer version states are the theme's badge colours, so a badge and its icon always match.
Properties
Badges
public DisplayAs Badges { get; set; }
How the slot cards' badges show. Full words by default.
Busy
public Color Busy { get; set; }
The colour of Saving and Loading.
CoOp
public Color CoOp { get; set; }
The colour of the co-op line.
Failure
public Color Failure { get; set; }
The colour of a save or load that did not work.
IconScale
public float IconScale { get; set; }
How big an icon is next to its words, as a share of their font size, from MinimumIconScale to MaximumIconScale. 1.15 by default.
Indicator
public DisplayAs Indicator { get; set; }
How the saving indicator shows its states. Icon and short words by default.
IndicatorPlace
public ScreenPlacement IndicatorPlace { get; }
Where the saving indicator sits. Bottom right by default. Never null.
Info
public Color Info { get; set; }
The colour of other news.
Locked
public Color Locked { get; set; }
The colour of Locked.
MoveSeconds
public float MoveSeconds { get; set; }
How long a box glides to a new place, from 0 (at once) to MaximumMoveSeconds. 0.25 by default.
Notes
public DisplayAs Notes { get; set; }
How the save notes show. Icon and short words by default.
NotesPlace
public ScreenPlacement NotesPlace { get; }
Where the save notes sit. Top centre by default. Never null.
StatusLine
public DisplayAs StatusLine { get; set; }
How the menu's status line and co-op line show. Full words by default.
Success
public Color Success { get; set; }
The colour of Saved and Loaded.
Constants
KindCount
public const int KindCount = 14;
How many kinds of message there are.
MaximumIconScale
public const float MinimumIconScale = 0.6f, MaximumIconScale = 2f;
The smallest and largest icon size, as a share of the words' font size.
MaximumMoveSeconds
public const float MaximumMoveSeconds = 1f;
The longest move or fade when a message box changes place.
MinimumIconScale
public const float MinimumIconScale = 0.6f, MaximumIconScale = 2f;
The smallest and largest icon size, as a share of the words' font size.
Methods
CopyChoicesFrom(MessageLook)
public void CopyChoicesFrom(MessageLook other);
Copies the choices from another look, keeping this look's colours: the displays, the places, the timing, and each kind's own icon and display. A ready-made style uses this to change the colours while keeping what the game chose.
| Parameter | Description |
|---|---|
other |
The look to copy from. Null uses the defaults. |
CopyFrom(MessageLook)
public void CopyFrom(MessageLook other);
Copies every value from another message look.
| Parameter | Description |
|---|---|
other |
The look to copy. Null resets to the defaults. |
DisplayFor(MessageKind, DisplayAs)
public DisplayAs DisplayFor(MessageKind kind, DisplayAs part);
How a message of a kind shows in a part of Shipready: the kind's own display when it has one, otherwise the part's.
| Parameter | Description |
|---|---|
kind |
The kind of message. |
part |
How the part shows its messages. |
Returns: The display to use.
Kind(MessageKind)
public MessageKindLook Kind(MessageKind kind);
One kind of message's own icon and display. Never null.
| Parameter | Description |
|---|---|
kind |
The kind. |
Returns: Its settings.
ShowsIcon(DisplayAs)
public static bool ShowsIcon(DisplayAs display);
Whether a display shows an icon.
| Parameter | Description |
|---|---|
display |
The display. |
Returns: true for the three icon displays.
ShowsWords(DisplayAs)
public static bool ShowsWords(DisplayAs display);
Whether a display shows words.
| Parameter | Description |
|---|---|
display |
The display. |
Returns: true for full text, short text, and icon and short text.
MessageSurface #
enum in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public enum MessageSurface
What a MessageView sits on.
Values
MessageView #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class MessageView : MonoBehaviour, ILayoutElement
Shows one message the way the theme asks (DisplayAs): its full or short words, its icon (plain or in the state's colour), both, or nothing. The saving indicator, the save notes, the menu's status line and the slot card badges are each one of these.
It lays its icon and words out itself, so they are always exactly centred: the block is in the middle of the box, the icon's middle sits level with the middle of the capital letters, and a turning icon turns about its own centre. Laying out happens only when the message changes, never each frame.
Add Component menu: Shipready → Message View
Properties
Background
public Image Background { get; }
The background. Null when the view has none.
Display
public DisplayAs Display { get; }
How the message is showing now.
flexibleHeight
public float flexibleHeight { get; }
Documented on the base type or interface.
flexibleWidth
public float flexibleWidth { get; }
Documented on the base type or interface.
Icon
public Image Icon { get; }
The icon. Null when the view was built without one.
Kind
public MessageKind Kind { get; }
The kind of message showing.
Label
public TMP_Text Label { get; }
The words. Null when the view was built without them.
layoutPriority
public int layoutPriority { get; }
Documented on the base type or interface.
maxHeight
public float maxHeight { get; }
No largest height: -1. Part of the layout interface in newer Unity UI versions.
maxWidth
public float maxWidth { get; }
No largest width: -1. Part of the layout interface in newer Unity UI versions.
minHeight
public float minHeight { get; }
Documented on the base type or interface.
minWidth
public float minWidth { get; }
Documented on the base type or interface.
preferredHeight
public float preferredHeight { get; }
Documented on the base type or interface.
preferredWidth
public float preferredWidth { get; }
Documented on the base type or interface.
Surface
public MessageSurface Surface { get; set; }
What the message sits on.
Words
public string Words { get; }
The words showing now, or empty when only an icon or nothing shows.
Methods
CalculateLayoutInputHorizontal()
public void CalculateLayoutInputHorizontal();
Documented on the base type or interface.
CalculateLayoutInputVertical()
public void CalculateLayoutInputVertical();
Documented on the base type or interface.
CapHeight(TMP_Text)
public static float CapHeight(TMP_Text text);
The height of a label's capital letters, in its own units.
| Parameter | Description |
|---|---|
text |
The label. |
Returns: The cap height, or 0 without a font.
Refresh()
public void Refresh();
Lays the message out again, such as after the theme's colours or sizes changed.
SetIconAngle(float)
public void SetIconAngle(float degrees);
Turns the icon about its centre, for a spinner. Allocates nothing.
| Parameter | Description |
|---|---|
degrees |
The angle, clockwise. |
Show(MessageKind, string, string, DisplayAs, MenuTheme)
public bool Show(MessageKind kind, string fullWords, string shortWords, DisplayAs display, MenuTheme theme);
Shows a message. Nothing is laid out again when the message, its display and the theme are what they were.
| Parameter | Description |
|---|---|
kind |
The kind of message, which picks its icon and colour. |
fullWords |
The whole sentence. |
shortWords |
A word or two. Empty uses the whole sentence. |
display |
How to show it. |
theme |
The look. Null keeps the parts' colours as they are and uses the built-in icons. |
Returns: false for DisplayAs.None: nothing shows, and the owner hides the view.
OrientationScaler #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class OrientationScaler : MonoBehaviour
Sits beside a kit canvas's Canvas Scaler and picks its reference size for the screen: the 1920×1080 design on a wide screen, and on a screen held upright (with the layout's MenuLayout.Portrait on Auto or Custom) a narrow one, so a phone gets words and buttons it can read and press. The menus listen to Changed and lay themselves out again. It checks the canvas's size every frame and acts only when it changes, as when a phone turns; it allocates nothing.
Add Component menu: Shipready → Orientation Scaler
Properties
IsPortrait
public bool IsPortrait { get; }
Whether the canvas uses the phone layout now.
LandscapeReference
public static Vector2 LandscapeReference { get; }
The design size on a wide screen.
Layout
public MenuLayout Layout { get; set; }
The layout whose Portrait setting applies. The menus set it from their theme. Null uses Auto.
Constants
AutoPortraitWidth
public const float AutoPortraitWidth = 760f;
How wide the phone layout is drawn on Auto, in canvas units.
Methods
Apply(bool)
public void Apply(bool force);
Picks the reference size for the canvas's size now, and tells the menus when the layout changes.
| Parameter | Description |
|---|---|
force |
Apply even when the size has not changed, such as after the layout's setting changed. |
ExpandScale(Vector2, Vector2)
public static float ExpandScale(Vector2 screen, Vector2 reference);
The scale the Canvas Scaler's Expand mode gives a screen: the whole reference fits.
| Parameter | Description |
|---|---|
screen |
The screen's size in pixels. |
reference |
The reference size. |
Returns: The scale.
ReferenceFor(Vector2, MenuLayout)
public static Vector2 ReferenceFor(Vector2 screen, MenuLayout layout);
The reference size for a screen: the 1920×1080 design on a wide screen; on one held upright, a narrow design of the same 16:9 shape turned on its side.
| Parameter | Description |
|---|---|
screen |
The screen's (or the canvas's) size in pixels. |
layout |
The layout whose Portrait setting applies; null uses Auto. |
Returns: The reference size.
UsesPortrait(Vector2, MenuLayout)
public static bool UsesPortrait(Vector2 screen, MenuLayout layout);
Whether a screen gets the phone layout.
| Parameter | Description |
|---|---|
screen |
The screen's size in pixels. |
layout |
The layout whose Portrait setting applies; null uses Auto. |
Returns: true when it is taller than wide and the setting is not Landscape.
Events
Changed
public event Action<bool> Changed;
Raised when the canvas starts or stops using the phone layout. The argument is whether it uses it now.
PortraitLayout #
enum in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public enum PortraitLayout
How Shipready's menus lay out on a screen held upright (taller than wide), such as a phone.
Values
| Name | Value | Description |
|---|---|---|
Auto |
0 |
A phone layout: the menus are drawn for a 760-unit-wide screen, so words and buttons are as big as a phone needs (body text about 31 pixels and buttons about 90 on a 1080-wide phone), the save menu fills the width with one column of tiles, and the Game Menu takes most of it. The default. |
Landscape |
1 |
The same layout as a wide screen, scaled down to fit the width. |
Custom |
2 |
The phone layout, drawn for the width of your choice (MenuLayout.PortraitWidth). |
RoundedSprites #
static class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public static class RoundedSprites
Makes the rounded shapes the menu is drawn with, so Shipready ships no sprite assets: a filled rounded rectangle and a rounded outline for any radius, as small 9-sliced sprites with anti-aliased corners. Each shape is made once and cached for the rest of the run.
The cache is cleared when a play session starts, so it is correct with domain reload switched off.
Constants
MaximumRadius
public const int MaximumRadius = 64;
The largest radius a sprite is made for. Larger requests are clamped.
PixelsPerUnit
public const float PixelsPerUnit = 100f;
The pixels per unit the sprites are made with, matching a canvas default of 100.
Methods
Get(int)
public static Sprite Get(int radius);
A white rounded rectangle, 9-sliced so it stretches to any size while the corners keep their radius. Tint it with Image.color.
| Parameter | Description |
|---|---|
radius |
The corner radius in pixels. 0 gives a plain square sprite. |
Returns: The sprite. Never null.
GetOutline(int, int)
public static Sprite GetOutline(int radius, int thickness);
A white rounded outline, 9-sliced, for the selection ring around a card.
| Parameter | Description |
|---|---|
radius |
The outer corner radius in pixels. |
thickness |
The line thickness in pixels, from 1 to 16. |
Returns: The sprite. Never null.
SafeAreaPanel #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class SafeAreaPanel : MonoBehaviour
Keeps a panel inside the screen's safe area: clear of a phone's notch, rounded corners and the home bar, and of a TV's overscan. It shrinks its own rectangle to Screen.safeArea, so everything under it (the save menu, the Game Menu, the saving indicator, the save notes) stays where the player can see and reach it. On a screen with no unsafe edges it fills the whole screen, so nothing changes. It checks again when the screen or its safe area changes, and allocates nothing.
Only a screen-space canvas is fitted; a world-space one (such as a preview in the Editor) is left whole. Simulated tries an inset without a phone.
Add Component menu: Shipready → Safe Area Panel
Properties
Area
public Rect Area { get; }
The part of its canvas this panel covers now, from (0, 0) to (1, 1).
Simulated
public static Rect? Simulated { get; set; }
A safe area to use instead of the screen's, as a share of the screen from (0, 0) bottom left to (1, 1) top right, such as new Rect(0.04f, 0.05f, 0.92f, 0.9f); null uses the screen's own. For trying a phone's insets on a desktop, and for tests. Applies to every Safe Area at once.
Methods
Apply()
public void Apply();
Fits the panel to the safe area now, such as right after Simulated changed.
SaveMenu #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class SaveMenu : MonoBehaviour
The player's save and load menu: one prefab, two modes. Drop SaveMenu.prefab into a scene and call Open(SaveMenuMode) from a pause menu or a main menu.
- Save mode lists the manual slots. An empty slot saves at once; a used one asks "Overwrite?" first. A thumbnail is taken just before the menu shows.
- Load mode lists the autosaves (newest first), the quicksave, then the manual slots that hold a save, then the empty ones, dimmed. Loading asks first whether unsaved progress may be lost (
ConfirmLoad). - Every card with a save can be deleted, after a confirmation. A damaged save loads through its backup and the status line says "Restored from backup (date)"; with automatic fallback switched off it offers Restore backup instead. A save from a newer version of the game shows a badge and cannot be loaded.
- A co-op client (
SaveKit.CanSavefalse) sees the cards without their buttons and a line saying only the host can save.
Mouse, touch, keyboard and gamepad all work, with the old Input Manager or the Input System: every button is a uGUI selectable on explicit navigation, so whichever input module the EventSystem has drives it. When the scene has no EventSystem the menu makes one. Cancel closes the open confirmation, or else the menu. Restyle it with a MenuTheme, translate it with a MenuText.
The menu holds no static state, so several can exist and it is safe with domain reload switched off. In Load Saved Scenes mode a load replaces the scenes, so keep the menu in a scene that stays loaded, or under DontDestroyOnLoad, if it should report the result.
Add Component menu: Shipready → Save Menu
Properties
AllowCopy
public bool AllowCopy { get; set; }
Whether saved slots in the Save menu show Copy, which copies the save into the first empty slot. Off by default.
BadgeDisplay
public DisplayAs BadgeDisplay { get; set; }
How the badges show when OwnBadgeDisplay is on. Setting it turns that on.
CaptureThumbnail
public bool CaptureThumbnail { get; set; }
Whether the Save menu takes a thumbnail just before it shows. On by default.
Cards
public IReadOnlyList<SlotCard> Cards { get; }
The cards the menu shows, top to bottom. Empty while the menu is closed.
CloseAfterLoad
public bool CloseAfterLoad { get; set; }
Whether the menu closes after a successful load. On by default. A load that had to use a backup keeps the menu open, so the player reads "Restored from backup".
CloseAfterSave
public bool CloseAfterSave { get; set; }
Whether the menu closes after a successful save. Off by default: the card shows the new save.
CloseKey
public KeyCode CloseKey { get; set; }
The key that backs out of a question or the menu. Escape by default; KeyCode.None for no key.
CloseWithGamepad
public bool CloseWithGamepad { get; set; }
Whether the gamepad's East button (B, Circle) backs out too. On by default.
Confirmation
public ISaveMenuConfirmation Confirmation { get; set; }
Your own confirmation, used instead of the menu's Dialog when set. Null, the default, uses the menu's own. The Inspector's Confirmation field sets it without code.
ConfirmLoad
public bool ConfirmLoad { get; set; }
Whether loading asks "Unsaved progress will be lost" first. On by default.
ConfirmRestore
public bool ConfirmRestore { get; set; }
Whether Restore backup asks first. Off by default: restoring keeps the damaged file aside, so it loses nothing.
ConsumedCancelThisFrame
public bool ConsumedCancelThisFrame { get; }
True in the frame in which Cancel (Escape, or East on a gamepad) closed the menu's confirmation or the menu itself, or asked a busy menu to close. A pause menu that reads Escape on its own should ignore that Escape: check this, and IsOpen, in LateUpdate, after the EventSystem has handled the frame's input.
Dialog
public ConfirmDialog Dialog { get; }
The confirmation the menu asks its questions with.
EffectiveBadgeDisplay
public DisplayAs EffectiveBadgeDisplay { get; }
How the badges show now: the menu's own display, or the theme's.
EffectiveStatusDisplay
public DisplayAs EffectiveStatusDisplay { get; }
How the status line shows now: the menu's own display, or the theme's.
IsBusy
public bool IsBusy { get; }
Whether a save, load or restore started from the menu is still running. While it is, the Back button cannot be used, and Close() and Cancel wait for it to finish before the menu closes.
IsOpen
public bool IsOpen { get; }
Whether the menu is showing.
IsPortrait
public bool IsPortrait { get; }
Whether the menu uses its phone layout now.
Mode
public SaveMenuMode Mode { get; }
Which mode the menu is in, or was last opened in.
OnClosed
public UnityEvent OnClosed { get; }
Invoked after the menu closes.
OnDeleted
public UnityEvent OnDeleted { get; }
Invoked after a delete the player confirmed succeeded.
OnFailed
public UnityEvent OnFailed { get; }
Invoked after a save, load, delete or restore from the menu failed.
OnLoaded
public UnityEvent OnLoaded { get; }
Invoked after a load the player started from the menu succeeded.
OnOpened
public UnityEvent OnOpened { get; }
Invoked after the menu opens. For a sound or an effect, without code.
OnQuestionAsked
public UnityEvent OnQuestionAsked { get; }
Invoked when the menu asks a question, such as "Overwrite Slot 2?".
OnRestored
public UnityEvent OnRestored { get; }
Invoked after Restore backup succeeded.
OnSaved
public UnityEvent OnSaved { get; }
Invoked after a save the player started from the menu succeeded.
OnSelectionMoved
public UnityEvent OnSelectionMoved { get; }
Invoked when keyboard or gamepad navigation, or the mouse, moves the selection to another part of the menu.
OwnBadgeDisplay
public bool OwnBadgeDisplay { get; set; }
Whether this menu's cards show their badges in their own way (BadgeDisplay) instead of the theme's.
OwnStatusDisplay
public bool OwnStatusDisplay { get; set; }
Whether this menu shows its status line in its own way (StatusDisplay) instead of the theme's.
PauseTimeWhileOpen
public bool PauseTimeWhileOpen { get; set; }
Whether the menu sets Time.timeScale to 0 while it is open and puts the old value back when it closes. Off by default, because most games pause in their own pause menu.
PlayerNamedSaves
public bool PlayerNamedSaves { get; set; }
Whether the player names their saves: saving asks for a name (starting from SaveKit.SlotName, or the slot's name), and saved slots show Rename. Off by default, so saving stays one click. The name becomes SaveKit.SlotName.
ShowAutosavesInLoadMode
public bool ShowAutosavesInLoadMode { get; set; }
Whether Load mode lists the autosaves, newest first, above the slots. On by default.
ShowQuicksaveInLoadMode
public bool ShowQuicksaveInLoadMode { get; set; }
Whether Load mode lists the quicksave, when the settings have it switched on and it exists. On by default.
StatusDisplay
public DisplayAs StatusDisplay { get; set; }
How the status line and the co-op line show when OwnStatusDisplay is on. Setting it turns that on.
StatusKind
public MessageKind StatusKind { get; }
The kind of the line on the status line now, which picks its icon and colour.
StatusMessage
public string StatusMessage { get; }
The last line shown on the status line, such as "Restored from backup (12 Oct 2026 18:41)". Never null.
Tab
public SaveMenuTab Tab { get; set; }
Which tab the Load menu shows: every save, only the player's own, or only the autosaves and the quicksave. Only used while the tabs show (the theme's MenuLayout.ShowTabs); the menu opens on SaveMenuTab.All.
TabsShown
public bool TabsShown { get; }
Whether the tabs are showing: Load mode, the layout has them on, and the Load menu lists autosaves or the quicksave.
Text
public MenuText Text { get; set; }
Every word the menu shows. Applied when the menu opens and straight away when set while it is open. Null uses the built-in English wording.
Theme
public MenuTheme Theme { get; set; }
The look of the menu. Applied when the menu opens and straight away when set while it is open. Null uses the built-in default colours.
ThumbnailCamera
public Camera ThumbnailCamera { get; set; }
The camera thumbnails are taken with. Null uses Camera.main.
Methods
Close()
public void Close();
Closes the menu, and any open confirmation, without doing anything else. While a save, load or restore started from the menu is running (IsBusy), the menu stays open, keeps its status line, and closes as soon as that finishes.
EnsureEventSystem()
public EventSystem EnsureEventSystem();
Makes sure the scene has an EventSystem, which uGUI needs for any input at all. When there is none, one is made with an InputSystemUIInputModule when the Input System is the active input handler, otherwise a StandaloneInputModule. The menu calls this when it opens.
Returns: The EventSystem in use, or null when one could not be made.
HandleCancel()
public void HandleCancel();
Backs out one step, as Cancel (Escape, or East on a gamepad) does: closes the open confirmation, or else the menu. At most once per frame, so one key press never closes both. While a save or load started from the menu is running, the menu closes once it has finished. ConsumedCancelThisFrame is true afterwards for the rest of the frame.
Open(SaveMenuMode)
public void Open(SaveMenuMode mode);
Opens the menu, or switches it to another mode. In Save mode the thumbnail is taken first, so the menu is never in the picture. The first card that can be used is selected, for keyboard and gamepad players.
| Parameter | Description |
|---|---|
mode |
Save or Load. |
Refresh()
public void Refresh();
Reads every slot again and redraws the cards, for when the game saved or deleted behind the menu's back.
SetTab(SaveMenuTab)
public void SetTab(SaveMenuTab tab);
Shows the Load menu on another tab.
| Parameter | Description |
|---|---|
tab |
The tab to show. |
Events
Closed
public event Action Closed;
Raised after the menu closes.
DeleteFinished
public event Action<int, SaveResult> DeleteFinished;
Raised when a delete the player confirmed has finished: the slot number (0 for an autosave or the quicksave) and the result.
LoadFinished
public event Action<int, LoadResult> LoadFinished;
Raised when a load the player started from the menu has finished: the slot number (0 for an autosave or the quicksave) and the result. LoadResult.RecoveredFromBackup says whether a backup had to be used.
Opened
public event Action<SaveMenuMode> Opened;
Raised after the menu opens, with the mode it opened in.
RestoreFinished
public event Action<int, SaveResult> RestoreFinished;
Raised when Restore backup has finished: the slot number (0 for an autosave or the quicksave) and the result.
SaveFinished
public event Action<int, SaveResult> SaveFinished;
Raised when a save the player started from the menu has finished: the slot number and the result.
SaveMenuHotkeys #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class SaveMenuHotkeys : MonoBehaviour
Test hotkeys for the save menu: F5 opens it in Save mode and F9 in Load mode, and the same key again closes it. The keys can be changed in the Inspector. Works with the old Input Manager and with the Input System package.
Meant for trying saves while you build the game, so by default the keys work only in the Editor (ActiveIn); choose Editor and builds to keep them in the finished game. The Start window and the Setup Wizard add it next to the menu.
Add Component menu: Shipready → Save Menu Hotkeys
Properties
ActiveIn
public HotkeysActiveIn ActiveIn { get; set; }
Where the keys work: only in the Editor (the default), in the Editor and in builds, or nowhere.
IsActive
public bool IsActive { get; }
Whether the keys work here and now, given ActiveIn.
LoadKey
public KeyCode LoadKey { get; set; }
The key that opens the menu in Load mode. KeyCode.None switches it off.
Menu
public SaveMenu Menu { get; set; }
The menu the keys open. Null uses a SaveMenu on this object or below it.
SaveKey
public KeyCode SaveKey { get; set; }
The key that opens the menu in Save mode. KeyCode.None switches it off.
Methods
IsActiveFor(HotkeysActiveIn, bool)
public static bool IsActiveFor(HotkeysActiveIn activeIn, bool inEditor);
Whether hotkeys set to activeIn work in the Editor or in a built game.
| Parameter | Description |
|---|---|
activeIn |
Where the keys are meant to work. |
inEditor |
Whether the game runs in the Editor rather than as a built player. |
Returns: true when the keys work.
SaveMenuMode #
enum in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public enum SaveMenuMode
Which job the save menu is doing: the same prefab saves and loads.
Values
| Name | Value | Description |
|---|---|---|
Save |
0 |
Lists the manual slots to save into: an empty slot saves at once, a used one asks first. |
Load |
1 |
Lists the autosaves, the quicksave and the manual slots to load from. |
SaveMenuTab #
enum in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public enum SaveMenuTab
Which saves the Load menu's tabs show. See SaveMenu.Tab.
Values
| Name | Value | Description |
|---|---|---|
All |
0 |
Every save: the autosaves, the quicksave and the player's own slots. |
Saves |
1 |
Only the player's own slots. |
Autosaves |
2 |
Only the autosaves and the quicksave. |
SaveNotes #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class SaveNotes : MonoBehaviour
A short note to the player when a load finished ("Game loaded"), when a save came back from its backup, or when a save or a load did not work, shown for a moment at the edge of the screen. The saving indicator already shows saves, so saves that worked are off by default. Drop SaveNotes.prefab into your first scene; it stays across scene loads. No code.
Like the indicator, it takes its colours, icons and font from the MenuTheme and its words from the MenuText. The theme says how it shows (DisplayAs) and where it sits (top centre by default); tick Own Display or Own Position to choose for these notes alone. Switch the component off to hide them.
Add Component menu: Shipready → Save Notes
Properties
Alpha
public float Alpha { get; }
How visible the note is, from 0 (hidden) to 1.
Display
public DisplayAs Display { get; set; }
How the notes show when OwnDisplay is on. Setting it turns OwnDisplay on.
EffectiveDisplay
public DisplayAs EffectiveDisplay { get; }
How the notes show now: their own display, or the theme's.
EffectivePlacement
public ScreenPlacement EffectivePlacement { get; }
Where the notes sit now: their own place, or the theme's.
FadeSeconds
public float FadeSeconds { get; set; }
How long a note fades in and out, in seconds. 0.25 by default.
Failures
public bool Failures { get; set; }
Whether a save or load that did not work gets a note. On by default.
Loads
public bool Loads { get; set; }
Whether a load that worked gets a note. On by default.
Message
public string Message { get; }
The words showing now. Empty when the note shows only an icon.
OwnDisplay
public bool OwnDisplay { get; set; }
Whether these notes show in their own way (Display) instead of the theme's.
OwnPosition
public bool OwnPosition { get; set; }
Whether these notes sit in their own place (Placement) instead of the theme's.
Placement
public ScreenPlacement Placement { get; }
Their own place, used when OwnPosition is on. Never null. After changing it, set OwnPosition (or call Refresh()) to move the notes.
Restores
public bool Restores { get; set; }
Whether a save that came back from its backup gets a note. On by default.
Saves
public bool Saves { get; set; }
Whether a save that worked gets a note. Off by default: the saving indicator shows saves.
Showing
public MessageKind Showing { get; }
The kind of the note showing now, or of the last one.
ShowSeconds
public float ShowSeconds { get; set; }
How long a note stays, in seconds. 2.5 by default.
Text
public MenuText Text { get; set; }
The words. Null uses the defaults. Applies at once.
Theme
public MenuTheme Theme { get; set; }
The look: the same theme asset as the save menu. Null uses the defaults. Applies at once.
View
public MessageView View { get; }
The view that shows the icon and words.
Methods
Refresh()
public void Refresh();
Applies the theme, the words, the display and the place again, such as after changing the theme asset.
Show(MessageKind)
public void Show(MessageKind kind);
Shows a note of a kind at once, as Shipready's own news does: for trying a look, or for news of your own (its words are the theme's for that kind).
| Parameter | Description |
|---|---|
kind |
The kind of note. |
SavingIndicator #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class SavingIndicator : MonoBehaviour
A small "Saving..." with a turning icon at the edge of the screen while a save runs, then "Saved" (or "Save failed") for a moment before it fades out. Players expect to see that an autosave happened. Drop SavingIndicator.prefab into your first scene; it stays across scene loads. No code.
Everything about it is yours: the colours, icons and font come from the same MenuTheme as the save menu, the words from its MenuText. The theme says how it shows (DisplayAs: words, icon, both or nothing) and where it sits; tick Own Display or Own Position here to choose for this indicator alone. The timings and which saves it shows for are set here. Switch the component off to hide it.
Add Component menu: Shipready → Saving Indicator
Nested types: SavingIndicator.State
Properties
Alpha
public float Alpha { get; }
How visible it is, from 0 (hidden) to 1.
Autosaves
public bool Autosaves { get; set; }
Whether autosaves show it. On by default.
Corner
public IndicatorCorner Corner { get; set; }
The corner it sits in. Setting it gives the indicator a place of its own (OwnPosition) in that corner. For the middle of an edge or any other point, use Placement.
Display
public DisplayAs Display { get; set; }
How it shows when OwnDisplay is on. Setting it turns OwnDisplay on.
EffectiveDisplay
public DisplayAs EffectiveDisplay { get; }
How it shows now: its own display, or the theme's.
EffectivePlacement
public ScreenPlacement EffectivePlacement { get; }
Where it sits now: its own place, or the theme's.
FadeSeconds
public float FadeSeconds { get; set; }
How long it fades in and out. 0.25 seconds by default.
GlobalFile
public bool GlobalFile { get; set; }
Whether saving the global file shows it. Off by default.
Message
public string Message { get; }
The words it shows now.
MinimumSeconds
public float MinimumSeconds { get; set; }
The least time "Saving..." shows. 1 second by default.
OwnDisplay
public bool OwnDisplay { get; set; }
Whether this indicator shows in its own way (Display) instead of the theme's.
OwnPosition
public bool OwnPosition { get; set; }
Whether this indicator sits in its own place (Placement) instead of the theme's.
Placement
public ScreenPlacement Placement { get; }
Its own place, used when OwnPosition is on. Never null. After changing it, set OwnPosition (or call Refresh()) to move the indicator.
Quicksave
public bool Quicksave { get; set; }
Whether the quicksave shows it. On by default.
SavedSeconds
public float SavedSeconds { get; set; }
How long "Saved" shows. 1 second by default.
ShowIcon
public bool ShowIcon { get; set; }
Whether the icon shows. Setting it gives the indicator a display of its own (OwnDisplay): the icon alone, the icon and words, or words alone.
Showing
public State Showing { get; }
What it is showing now.
ShowWords
public bool ShowWords { get; set; }
Whether the words show. Setting it gives the indicator a display of its own (OwnDisplay): words alone, the icon and words, or the icon alone.
Slots
public bool Slots { get; set; }
Whether saves into the numbered slots show it. On by default.
Text
public MenuText Text { get; set; }
The words. Null uses the defaults. Applies at once.
Theme
public MenuTheme Theme { get; set; }
The look: the same theme asset as the save menu. Null uses the defaults. Applies at once.
View
public MessageView View { get; }
The view that shows the icon and words. Null in an indicator built before it had one.
Methods
Refresh()
public void Refresh();
Applies the theme, the words, the display and the place again, such as after changing the theme asset.
ShowFinished(bool)
public void ShowFinished(bool success);
Ends what ShowSaving() started, as a finished save would.
| Parameter | Description |
|---|---|
success |
Whether to show "Saved" or "Save failed". |
ShowSaving()
public void ShowSaving();
Shows it as a save would, without saving: for trying a look, or for your own long work.
SavingIndicator.State #
enum in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public enum State
What the indicator is showing.
Values
| Name | Value | Description |
|---|---|---|
Hidden |
0 |
Nothing: it is hidden. |
Saving |
1 |
A save is running. |
Saved |
2 |
The save worked: "Saved" for a moment. |
Failed |
3 |
The save failed: "Save failed" for a moment. |
ScreenPlacement #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class ScreenPlacement
Where a message box sits: one of six places on the screen's edges, or any point of it, and how far in from the edge. Sizes are in pixels at the 1920×1080 reference resolution.
Constructors
ScreenPlacement()
public ScreenPlacement();
Makes a placement in the bottom right corner, 40 pixels in.
ScreenPlacement(ScreenPosition, float)
public ScreenPlacement(ScreenPosition position, float margin);
Makes a placement at one of the six places.
| Parameter | Description |
|---|---|
position |
The place. |
margin |
How far in from the edge. |
Properties
Anchor
public Vector2 Anchor { get; }
The point of the screen the box is anchored to, which is also the point of the box placed there.
AnchoredPosition
public Vector2 AnchoredPosition { get; }
Where the box's anchor point goes, measured from the screen's anchor point.
CustomAnchor
public Vector2 CustomAnchor { get; set; }
For ScreenPosition.Custom: the point of the screen, from (0, 0) bottom left to (1, 1) top right.
Margin
public float Margin { get; set; }
How far in from the screen's edge, from 0 to MaximumMargin.
Offset
public Vector2 Offset { get; set; }
For ScreenPosition.Custom: how far the box is moved from CustomAnchor.
Position
public ScreenPosition Position { get; set; }
Where on the screen the box sits.
Constants
MaximumMargin
public const float MaximumMargin = 400f;
The largest margin from the screen's edge.
Methods
ApplyTo(RectTransform)
public void ApplyTo(RectTransform box);
Puts a box where this placement says, at once.
| Parameter | Description |
|---|---|
box |
The box. Nothing happens when null. |
CopyFrom(ScreenPlacement)
public void CopyFrom(ScreenPlacement other);
Copies every value from another placement.
| Parameter | Description |
|---|---|
other |
The placement to copy. Null resets to the bottom right corner. |
SameAs(ScreenPlacement)
public bool SameAs(ScreenPlacement other);
Whether two placements put a box in the same place.
| Parameter | Description |
|---|---|
other |
The other placement. |
Returns: true when they match.
ScreenPosition #
enum in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public enum ScreenPosition
Where on the screen a message box sits.
Values
| Name | Value | Description |
|---|---|---|
TopLeft |
0 |
The top left corner. |
TopCentre |
1 |
The middle of the top edge. |
TopRight |
2 |
The top right corner. |
BottomLeft |
3 |
The bottom left corner. |
BottomCentre |
4 |
The middle of the bottom edge. |
BottomRight |
5 |
The bottom right corner. |
Custom |
6 |
Any point of the screen: ScreenPlacement.CustomAnchor plus ScreenPlacement.Offset. |
SlotCard #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class SlotCard : MonoBehaviour
One save in the menu's list: its thumbnail on the left; its name, badges, date, playtime, location and first two summary lines in the middle; its buttons on the right. SaveMenu makes the cards from the SlotCard prefab and fills them in; a game reads them, it does not need to drive them.
The card itself is selectable (MainSelectable): Submit on it, or a click or tap on it, does the card's main action, Save or Load. Its buttons sit to its right on the keyboard and gamepad navigation.
Add Component menu: Shipready → Slot Card
Properties
AutosaveBadge
public GameObject AutosaveBadge { get; }
The Autosave badge, which also says Quicksave on the quicksave card.
CopyButton
public Button CopyButton { get; }
Copies this save into the first empty slot (Save mode, when the menu's Allow Copy is on). Null on a card without one.
DamagedBadge
public GameObject DamagedBadge { get; }
The Damaged badge: the main file of this save is damaged.
DateLabel
public TMP_Text DateLabel { get; }
When the save was made, in local time.
DeleteButton
public Button DeleteButton { get; }
Deletes this save, after a confirmation.
DisplayName
public string DisplayName { get; }
The name the card shows, also used in the menu's questions.
HasUsableMainAction
public bool HasUsableMainAction { get; }
Whether the card's main action, Save or Load, can be done now.
Info
public SlotInfo Info { get; }
What the card shows. Null before the menu fills the card in.
IsNavigable
public bool IsNavigable { get; }
Whether the card can be selected and used: it holds a save, or it is a slot to save into.
LoadButton
public Button LoadButton { get; }
Loads this save (Load mode only).
LocationLabel
public TMP_Text LocationLabel { get; }
Where the player was.
MainSelectable
public Selectable MainSelectable { get; }
What keyboard and gamepad navigation selects for this card: the card itself.
NameLabel
public TMP_Text NameLabel { get; }
The save's name.
NewerBadge
public GameObject NewerBadge { get; }
The From a newer version badge: this game cannot load the save.
PlaytimeLabel
public TMP_Text PlaytimeLabel { get; }
How long the player had played, as h:mm:ss.
RenameButton
public Button RenameButton { get; }
Renames this save (Save mode, when the menu's Player Named Saves is on). Null on a card without one.
RestoreButton
public Button RestoreButton { get; }
Puts the newest valid backup of a damaged save back (shown when automatic fallback is off).
RestoredBadge
public GameObject RestoredBadge { get; }
The Restored badge: what the card shows was read from a backup copy.
SaveButton
public Button SaveButton { get; }
Saves into this slot (Save mode only).
SlotNumber
public int SlotNumber { get; }
Which manual slot the card shows, counting from 1. 0 for an autosave or the quicksave.
SummaryLabels
public IReadOnlyList<TMP_Text> SummaryLabels { get; }
The labels for the first two summary lines the game supplied. Always exactly two.
Thumbnail
public RawImage Thumbnail { get; }
The thumbnail. Its texture is null when the save has none.
Constants
SummaryLineCount
public const int SummaryLineCount = 2;
How many summary lines a card shows.
SlotListLayout #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class SlotListLayout : LayoutGroup
Lays the save menu's cards out as a list (one column) or as a grid of tiles (two to four columns). SaveMenu sets the columns and the spacing from the theme's MenuTheme.Layout, so switching between list and grid needs no prefab edit.
With one column it lays the cards out exactly as a VerticalLayoutGroup that controls the children's size and stretches them to the full width: each card is as tall as its preferred height. In a grid every tile in a row gets the same width, and each row is as tall as its tallest tile.
Add Component menu: Shipready → Slot List Layout
Properties
Columns
public int Columns { get; set; }
How many columns: 1 is a list, 2 to 4 a grid.
Spacing
public float Spacing { get; set; }
The gap between two cards, across and down.
Methods
CalculateLayoutInputHorizontal()
public override void CalculateLayoutInputHorizontal();
Works out how wide the cards want the list to be. The list takes its width from its parent.
CalculateLayoutInputVertical()
public override void CalculateLayoutInputVertical();
Works out how tall the list is: every card, or every row of tiles, and the gaps between them.
SetLayoutHorizontal()
public override void SetLayoutHorizontal();
Sets each card's left edge and width.
SetLayoutVertical()
public override void SetLayoutVertical();
Sets each card's top edge and height.
SlotListScroller #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class SlotListScroller : MonoBehaviour
Keeps the selected entry of a scrolling list in view. When keyboard or gamepad navigation moves the selection to an entry that is partly or wholly outside the ScrollRect's viewport, the list glides just far enough to show all of it. This is what makes every one of 99 slots reachable with a gamepad.
Put it on the object with the ScrollRect. It only reacts to a change of selection, so it never fights the mouse wheel or a drag. It runs on unscaled time, so it also works while the game is paused.
Add Component menu: Shipready → Slot List Scroller
Properties
GlideSeconds
public float GlideSeconds { get; set; }
Roughly how long the glide takes, in seconds. 0 jumps straight there.
IsScrolling
public bool IsScrolling { get; }
Whether the list is still gliding towards an entry.
Margin
public float Margin { get; set; }
How much room to leave between the selected entry and the edge of the viewport.
Methods
ResetTracking()
public void ResetTracking();
Forgets the selection it last saw, so the next selection is treated as new.
ScrollIntoView(RectTransform, bool)
public void ScrollIntoView(RectTransform item, bool instant);
Scrolls the list so an entry is wholly in view.
| Parameter | Description |
|---|---|
item |
An entry of the list: the content's child, or anything inside one. |
instant |
Whether to jump there rather than glide. |
ThemedElement #
class in RareGeometry.Shipready.Save.UI · assembly RareGeometry.Shipready.Save.UI
public sealed class ThemedElement : MonoBehaviour, ISelectHandler, IDeselectHandler
Gives one piece of the menu its look from a MenuTheme: the colour and rounded shape of an image, the colours of a button and its label, or the font, size and colour of a label. The generated prefabs carry one on every piece, and SaveMenu applies the theme when it opens and whenever SaveMenu.Theme changes.
Because the theme is applied at runtime, a colour changed by hand on an element that has this component is replaced by the theme's. Remove the component from an element in a prefab variant to style that element by hand.
Add Component menu: Shipready → Themed Element
Properties
Colour
public Color Colour { get; set; }
This part's own colour, used while OverrideColour is on.
EndWithEllipsis
public bool EndWithEllipsis { get; set; }
Whether the label ends in '…' when it runs out of room, where its font can draw that character; otherwise it is cut off.
FontSize
public float FontSize { get; set; }
This part's own font size, used while OverrideFontSize is on.
KeepOwnImage
public bool KeepOwnImage { get; set; }
Whether this part keeps the sprite its Image already has. The theme still sets its colours, but never replaces the sprite with the rounded shape or the theme's own image. Off by default.
OverrideColour
public bool OverrideColour { get; set; }
Whether this part uses Colour instead of the theme's colour.
OverrideFontSize
public bool OverrideFontSize { get; set; }
Whether this part uses FontSize instead of the theme's size.
Role
public MenuThemeRole Role { get; set; }
What this piece of the menu is. Setting it does not re-apply the theme; call Apply(MenuTheme).
ShrinkToFit
public bool ShrinkToFit { get; set; }
Whether the label shrinks to fit, from the theme's size down to 60% of it, before it wraps or is cut off. Off by default.
Methods
Apply(MenuTheme)
public void Apply(MenuTheme theme);
Gives this element its look from a theme, shapes included.
| Parameter | Description |
|---|---|
theme |
The theme. Null does nothing. |
Apply(MenuTheme, bool)
public void Apply(MenuTheme theme, bool withShapes);
Gives this element its look from a theme.
| Parameter | Description |
|---|---|
theme |
The theme. Null does nothing. |
withShapes |
Whether to set the rounded sprites too. The menu generator passes false, because the sprites are made while the game runs and are not assets a prefab can keep. |
OnDeselect(BaseEventData)
public void OnDeselect(BaseEventData eventData);
Called by the EventSystem when the selection leaves the button this sits on.
| Parameter | Description |
|---|---|
eventData |
The event. |
OnSelect(BaseEventData)
public void OnSelect(BaseEventData eventData);
Called by the EventSystem when the button this sits on is selected: a ring in the theme's accent shows where the keyboard or gamepad is.
| Parameter | Description |
|---|---|
eventData |
The event. |
RefreshState()
public void RefreshState();
Updates a button label's colour for whether the button can be used. The menu calls it after it changes interactable.
Namespace RareGeometry.Shipready.Save.Editor #
KitLinks #
static class in RareGeometry.Shipready.Save.Editor · assembly RareGeometry.Shipready.Save.Editor.Core
public static class KitLinks
Every web address and the e-mail address Shipready shows, in one place: the editor tools' help buttons read them from here, and tools/fill-placeholders.ps1 reads this file to write them into the documents, in place of the WEBSITE, SUPPORT_REPO, ISSUE_FORM, DISCUSSIONS, DISCORD and SUPPORT_EMAIL placeholders and of the values it wrote last time. To change one, edit it here and run that script. Keep each value a plain string constant on one line, so the script can read it.
Constants
BugReportForm
public const string BugReportForm = "https:;
The bug report form in the support repository.
Discord
public const string Discord = "https:;
The Rare Geometry Discord server's permanent invite. While it is empty, the editor tools show no Discord link.
Discussions
public const string Discussions = "https:;
Questions and answers: the support repository's Discussions.
FeatureRequestForm
public const string FeatureRequestForm = "https:;
The feature request form in the support repository.
SupportEmail
public const string SupportEmail = RareGeometry.Core.StudioInfo.SupportEmail;
The support e-mail address, also for reporting security issues privately.
SupportRepository
public const string SupportRepository = "https:;
The public support repository: bug reports, feature requests and Discussions.
Website
public const string Website = "https:;
The publisher's website, with the documentation for every kit.
Namespace RareGeometry.Shipready.Save.Editor.Build #
MigrationLinkXmlBuilder #
class in RareGeometry.Shipready.Save.Editor.Build · assembly RareGeometry.Shipready.Save.Editor.Core
public sealed class MigrationLinkXmlBuilder : IUnityLinkerProcessor
Keeps migration steps alive through code stripping.
Nothing in a game calls a migration directly: Shipready finds them by looking for the [SaveMigration] attribute. Code stripping cannot see that, so in an IL2CPP build with stripping turned up it would remove the very methods that let an old save load. This adds a link file during the build naming every type that holds one, which is the supported way to tell the stripper to leave something alone.
The file is written to the project's Temp/RareGeometry.Shipready.Save folder, which Unity clears when the Editor closes, and handed to the linker by path, so nothing is left behind in the project. If it cannot be written the build log says so as an error, because a build without it can silently lose the migrations.
Properties
callbackOrder
public int callbackOrder { get; }
Where this step runs relative to other build callbacks.
Constants
LinkFileName
public const string LinkFileName = "MigrationLink.xml";
The name of the generated link file.
Methods
FindMigrationTypes()
public static Dictionary<string, List<string>> FindMigrationTypes();
Every type holding a method marked [SaveMigration], grouped by the assembly it lives in. Only assemblies that go into a player are included, which leaves out Editor and test assemblies whatever they are called. Type names are written the way the linker expects them, with / between a nested type and the type around it. Exposed so Diagnostics can report the same list.
Returns: Assembly name to type names, both in ordinal order. Never null.
GenerateAdditionalLinkXmlFile(BuildReport, UnityLinkerBuildPipelineData)
public string GenerateAdditionalLinkXmlFile(BuildReport report, UnityLinkerBuildPipelineData data);
Writes the link file for this build.
| Parameter | Description |
|---|---|
report |
The build report Unity is filling in. |
data |
What Unity knows about this linker run. Not used. |
Returns: The path of the link file, or null when there are no migrations to keep.
GetOutputFolder()
public static string GetOutputFolder();
The folder the link file is written to: Temp/RareGeometry.Shipready.Save inside the project, beside the Assets folder.
Returns: An absolute folder path.
ToLinkerName(Type)
public static string ToLinkerName(Type type);
A type name in the form the linker reads in a link file. Reflection writes a nested type as Outer+Inner; the linker wants Outer/Inner, and silently ignores a name it does not recognise.
| Parameter | Description |
|---|---|
type |
The type to name. |
Returns: The name, or an empty string for null.
Namespace RareGeometry.Shipready.Save.Editor.Common #
SceneLoadingHooksInstaller #
static class in RareGeometry.Shipready.Save.Editor.Common · assembly RareGeometry.Shipready.Save.Editor.Core
public static class SceneLoadingHooksInstaller
Lets Shipready's default scene loader open, in the Editor, a saved scene that is not in Build Settings, so a scene being tested before it is added there still loads and restores with SaveKit.LoadAsync. A build cannot load such a scene, and Shipready warns once per scene when this happens. Unity installs it whenever scripts load.
Methods
FindSceneAsset(string, string, string, bool)
public static string FindSceneAsset(string sceneId, string scenePath, string sceneName, out bool matchedByName);
The project path of a scene asset: by the asset GUID the scene id names, then by its path, then by its name when exactly one scene in the project has that name.
| Parameter | Description |
|---|---|
sceneId |
The saved scene id, or empty. |
scenePath |
The scene path, or empty. |
sceneName |
The scene name, or empty. |
matchedByName |
Whether the scene was found only by its name. |
Returns: The path of the scene asset, or null when there is none.
Install()
public static void Install();
Points the default scene loader's Editor hook at LoadSceneInPlayMode(string, string, string, LoadSceneMode, string, bool). Unity does this when scripts load; calling it again does no harm.
LoadSceneInPlayMode(string, string, string, LoadSceneMode, string, bool)
public static AsyncOperation LoadSceneInPlayMode(string sceneId, string scenePath, string sceneName, LoadSceneMode mode, out string loadedPath, out bool matchedByName);
Starts loading a scene asset straight from the project in Play Mode, found by the asset GUID the scene id names, then by its path, then by its name when exactly one scene in the project has it. Never throws.
| Parameter | Description |
|---|---|
sceneId |
The saved scene id; for a registered scene its asset GUID. May be empty. |
scenePath |
The scene path, such as Assets/Levels/Town.unity, or empty. |
sceneName |
The scene name, such as Town, or empty. |
mode |
Whether the scene replaces the loaded ones or is added to them. |
loadedPath |
The path of the scene that is loading, or null. |
matchedByName |
Whether the scene was found only by its name. |
Returns: The load in progress, or null outside Play Mode or when the project has no such scene.
Namespace RareGeometry.Shipready.Save.Editor.Registries #
RegistryUpkeep #
static class in RareGeometry.Shipready.Save.Editor.Registries · assembly RareGeometry.Shipready.Save.Editor.Core
public static class RegistryUpkeep
Keeps the Prefab, Asset and Scene Registries in step with the project, and keeps the Saveable ids on prefab assets right.
Prefabs. A Saveable on the root of a prefab asset carries the prefab's asset GUID as its prefab id, and the prefab is listed in the Prefab Registry under that GUID. A Saveable on a child carries a prefab-local id that is unique inside the prefab and never changes once given. No Saveable on a prefab asset carries an object id: those belong to scene objects only. Prefabs are checked whenever Unity imports them, and saved again only when something has to change. Prefabs whose asset is deleted leave the registry.
Scenes. Every scene in Build Settings is listed in the Scene Registry under its asset GUID, with its path as a label, and so is any scene registered by hand with RegisterScene(SceneAsset). When a listed scene is moved or renamed its path is updated, so the GUID that saves are keyed by still finds it. Deleted scenes leave the registry.
Assets. The Asset Registry is curated: assets are added with RegisterAsset(AssetRegistry, UnityEngine.Object) (Diagnostics offers it), and upkeep only removes entries whose asset is gone.
The registries are the ones the settings asset (Resources/ShipreadySaveSettings) points at. While it has none, the registries are left alone; prefab ids are still kept right. Automatic upkeep is not recorded for Undo: moving, renaming or deleting an asset cannot be undone either, and an Undo that put back an old scene path would quietly break old saves.
Constants
RebuildMenuPath
public const string RebuildMenuPath = "Tools/Shipready/Registries/Rebuild Registries";
The menu command that rebuilds every registry.
RegisterSelectedMenuPath
public const string RegisterSelectedMenuPath = "Tools/Shipready/Registries/Register Selected Assets";
The menu command that registers the selected assets in the Asset Registry.
Methods
CanRegisterAsset(UnityEngine.Object)
public static bool CanRegisterAsset(Object item);
Whether an object can be registered by RegisterAssets(AssetRegistry, IList<UnityEngine.Object>, int): a ScriptableObject or a prefab saved in the project. Folders, scenes, scripts, scene objects and Shipready's own settings and registries cannot.
| Parameter | Description |
|---|---|
item |
The object, usually from the Project window selection. |
Returns: true when it can be registered.
FindSettings()
public static SaveKitSettings FindSettings();
The settings asset the game loads at runtime: the ShipreadySaveSettings asset in a Resources folder.
Returns: The settings, or null when the project has none yet.
GetPrefabLocalId(Saveable)
public static string GetPrefabLocalId(Saveable saveable);
The prefab-local id of a Saveable: the id that tells apart the Saveables on the children of one prefab. Empty on scene objects made from scratch and on prefab roots.
| Parameter | Description |
|---|---|
saveable |
The Saveable. |
Returns: The id, or an empty string.
OnAssetsDeleted(string[], PrefabRegistry, AssetRegistry, SceneRegistry)
public static RegistryUpkeepResult OnAssetsDeleted(string[] deletedPaths, PrefabRegistry prefabs, AssetRegistry assets, SceneRegistry scenes);
What upkeep does when assets are deleted: a deleted scene leaves the Scene Registry, and prefabs and assets that no longer exist leave theirs. Not recorded for Undo.
| Parameter | Description |
|---|---|
deletedPaths |
The deleted asset paths. Null or empty does nothing. |
prefabs |
The Prefab Registry, or null. |
assets |
The Asset Registry, or null. |
scenes |
The Scene Registry, or null. |
Returns: What changed.
OnAssetsImported(string[], PrefabRegistry, SceneRegistry)
public static RegistryUpkeepResult OnAssetsImported(string[] importedPaths, PrefabRegistry prefabs, SceneRegistry scenes);
What upkeep does when Unity imports assets: each prefab gets its Saveable ids checked and, when its root has a Saveable, is listed in the Prefab Registry; a scene that is in Build Settings or already listed is listed with its current path. The automatic upkeep calls this for the settings registries; tests and tools may call it with their own. Not recorded for Undo.
| Parameter | Description |
|---|---|
importedPaths |
The imported asset paths. Null does nothing. |
prefabs |
The Prefab Registry, or null to only check prefab ids. |
scenes |
The Scene Registry, or null to skip scenes. |
Returns: What changed.
OnAssetsMoved(string[], string[], SceneRegistry)
public static RegistryUpkeepResult OnAssetsMoved(string[] movedTo, string[] movedFrom, SceneRegistry scenes);
What upkeep does when assets are moved or renamed: a listed scene gets its new path under the same id, so old saves still find it (and a Build Settings scene that was not listed yet is added). Prefab and asset entries hold the asset itself, so a move does not affect them. Not recorded for Undo.
| Parameter | Description |
|---|---|
movedTo |
The new asset paths. Null does nothing. |
movedFrom |
The old asset paths, in the same order as movedTo. |
scenes |
The Scene Registry, or null. |
Returns: What changed.
RebuildAll()
public static RegistryUpkeepResult RebuildAll();
Brings the registries named by the settings asset fully up to date: every prefab in the project is checked, every Build Settings scene is listed, listed scenes get their current path, and entries whose asset is gone are removed. Prefab ids are kept right even when the settings have no registries yet. Registry changes can be undone.
Returns: What changed.
RebuildAll(PrefabRegistry, AssetRegistry, SceneRegistry)
public static RegistryUpkeepResult RebuildAll(PrefabRegistry prefabs, AssetRegistry assets, SceneRegistry scenes);
Brings the given registries fully up to date, searching the whole Assets folder for prefabs. Any registry may be null, and is then skipped.
| Parameter | Description |
|---|---|
prefabs |
The Prefab Registry to keep, or null. |
assets |
The Asset Registry to keep, or null. |
scenes |
The Scene Registry to keep, or null. |
Returns: What changed.
RebuildAll(PrefabRegistry, AssetRegistry, SceneRegistry, string[])
public static RegistryUpkeepResult RebuildAll(PrefabRegistry prefabs, AssetRegistry assets, SceneRegistry scenes, string[] searchFolders);
Brings the given registries fully up to date, searching only some folders for prefabs. Build Settings scenes and scenes already listed are kept wherever they are. Any registry may be null, and is then skipped.
| Parameter | Description |
|---|---|
prefabs |
The Prefab Registry to keep, or null. |
assets |
The Asset Registry to keep, or null. |
scenes |
The Scene Registry to keep, or null. |
searchFolders |
Project folders to look for prefabs in, such as Assets/Prefabs. Null or empty means the whole Assets folder. Folders that do not exist are skipped. |
Returns: What changed.
RegisterAsset(AssetRegistry, UnityEngine.Object)
public static bool RegisterAsset(AssetRegistry registry, Object asset);
Adds an asset, such as an item definition, to an Asset Registry so that saved links to it can be restored. Its id is the asset GUID, or GUID:localId for an object stored inside another asset. An asset that is already listed keeps the id it has. Recorded for Undo.
| Parameter | Description |
|---|---|
registry |
The Asset Registry. |
asset |
The asset. Scene objects cannot be registered. |
Returns: true when the asset is listed afterwards; false for null or a non-asset.
RegisterAssets(AssetRegistry, IList<UnityEngine.Object>, int)
public static int RegisterAssets(AssetRegistry registry, IList<Object> items, out int skipped);
Adds several assets, such as item definitions linked only from ISaveable code, to an Asset Registry in one undo step, each through RegisterAsset(AssetRegistry, UnityEngine.Object). Objects CanRegisterAsset(UnityEngine.Object) refuses are skipped and counted.
| Parameter | Description |
|---|---|
registry |
The Asset Registry. |
items |
The assets. Null registers nothing. |
skipped |
How many of them could not be registered. |
Returns: How many are newly listed; ones already listed count as neither added nor skipped.
RegisterPrefab(PrefabRegistry, GameObject)
public static bool RegisterPrefab(PrefabRegistry registry, GameObject prefab);
Lists a prefab in a Prefab Registry under its asset GUID, after putting its Saveable ids right. Recorded for Undo.
| Parameter | Description |
|---|---|
registry |
The Prefab Registry. |
prefab |
The prefab asset, or any object inside it. |
Returns: true when the prefab is in the registry afterwards; false for null or a non-prefab.
RegisterScene(SceneAsset)
public static bool RegisterScene(SceneAsset scene);
Lists a scene in the settings asset's Scene Registry under its asset GUID, so it is kept up to date from now on even if it is not in Build Settings. Recorded for Undo.
| Parameter | Description |
|---|---|
scene |
The scene asset. |
Returns: true when the scene is listed afterwards; false when there is no registry yet.
RegisterScene(SceneRegistry, SceneAsset)
public static bool RegisterScene(SceneRegistry registry, SceneAsset scene);
Lists a scene in a Scene Registry under its asset GUID, with its path. Recorded for Undo.
| Parameter | Description |
|---|---|
registry |
The Scene Registry. |
scene |
The scene asset. |
Returns: true when the scene is listed afterwards; false for null or a scene that is not saved.
TryGetAssetId(UnityEngine.Object, string)
public static bool TryGetAssetId(Object asset, out string id);
The id an asset gets in the Asset Registry: its asset GUID when it is the main asset of its file, otherwise GUID:localId (for example a sprite inside a texture).
| Parameter | Description |
|---|---|
asset |
The asset. |
id |
The id, or an empty string. |
Returns: true for a saved asset; false for null, scene objects and unsaved objects.
UpdatePrefabIds(string)
public static bool UpdatePrefabIds(string prefabPath);
Checks the Saveable ids on one prefab asset and saves it again when they need fixing: the root's prefab id is the asset GUID, children have unique prefab-local ids, and nothing carries an object id.
| Parameter | Description |
|---|---|
prefabPath |
The prefab's asset path, such as Assets/Crate.prefab. |
Returns: true when the prefab was changed and saved.
RegistryUpkeepResult #
class in RareGeometry.Shipready.Save.Editor.Registries · assembly RareGeometry.Shipready.Save.Editor.Core
public sealed class RegistryUpkeepResult
What one run of RegistryUpkeep changed: prefab assets whose Saveable ids were put right, and registry entries added, updated or removed.
Properties
Added
public int Added { get; }
Registry entries that were added.
Failed
public int Failed { get; }
Prefab assets that needed fixing but could not be saved. The Console says why.
HasChanges
public bool HasChanges { get; }
Whether anything was changed.
PrefabsUpdated
public int PrefabsUpdated { get; }
Prefab assets that were saved again because their Saveable ids needed fixing.
Removed
public int Removed { get; }
Registry entries that were removed because their asset is gone.
Updated
public int Updated { get; }
Registry entries that were changed, such as a scene's path after a move or rename.
Methods
Add(RegistryUpkeepResult)
public void Add(RegistryUpkeepResult other);
Adds another result's counts to this one.
| Parameter | Description |
|---|---|
other |
The result to add. Null adds nothing. |
ToString()
public override string ToString();
A one-line summary for the Console, such as "1 prefab fixed, 2 entries added".
Returns: The summary.
SaveableDuplicateScan #
static class in RareGeometry.Shipready.Save.Editor.Registries · assembly RareGeometry.Shipready.Save.Editor.Core
public static class SaveableDuplicateScan
Keeps every Saveable in the open scenes on its own id while you edit.
A Saveable fixes its own id when it wakes, but an inactive object never wakes, so a copy of an inactive object would keep the original's id. This scan runs after any change to the Hierarchy, at most once per Editor update and never in Play Mode. It looks at every Saveable in every loaded scene, inactive ones included, and gives a new id to any that has none or shares one with another.
Who keeps a shared id. The Saveable that held the id when the scan last ran keeps it, so the original keeps its id however the copy is moved around. When the scan has not seen the id before (a scene just opened, or the first scan after scripts reload), the first Saveable in scene order keeps it: scenes in the order the Hierarchy lists them, then objects from top to bottom, parents before their children. A copy made with Duplicate sits just below its original, so the original still wins.
Objects that Unity never saves (HideFlags.DontSaveInEditor) are left alone. A fix made by the automatic scan joins the undo step of the change that caused it, so one Undo removes both.
Properties
Enabled
public static bool Enabled { get; set; }
Whether the scan runs by itself after Hierarchy changes. On by default. A tool that needs duplicates to stay for a moment (a test of Diagnostics, for example) can switch it off and must switch it back on. ScanLoadedScenes() works either way.
Methods
ScanLoadedScenes()
public static int ScanLoadedScenes();
Scans every loaded scene now and gives a new id to each Saveable whose id is empty or already taken (see the class description for who keeps a shared id). Each fix is recorded for Undo and marks its scene as changed. Does nothing in Play Mode.
Returns: How many Saveables were given a new id.
SaveableEditorHooksInstaller #
static class in RareGeometry.Shipready.Save.Editor.Registries · assembly RareGeometry.Shipready.Save.Editor.Core
public static class SaveableEditorHooksInstaller
Connects the Saveable component to the Editor.
The runtime code cannot use Editor API, yet a Saveable has to know two Editor-only things when it gives itself an id in Edit Mode: whether it is part of a prefab asset or a prefab being edited (those never carry an object id), and how to tell Unity that its scene changed so the new id is saved. This class answers both, and Unity installs it whenever scripts load.
Marking dirty is deferred to the next Editor update, because a Saveable gives itself an id from Reset, OnValidate or Awake, where Unity does not allow scene changes. Nothing is marked in Play Mode, and objects destroyed in the meantime are skipped.
Methods
Install()
public static void Install();
Points the Saveable's Editor hooks at this class. Unity does this when scripts load; calling it again does no harm.
IsPrefabContext(Saveable)
public static bool IsPrefabContext(Saveable saveable);
Whether a Saveable belongs to a prefab rather than to a scene: it is part of a prefab asset, it is not in any valid scene, or it is in a preview scene such as Prefab Mode. Such a Saveable keeps its object id empty.
| Parameter | Description |
|---|---|
saveable |
The Saveable to check. |
Returns: true for a prefab asset or prefab-editing context. false for a scene object and for null. When Unity cannot answer, true: the duplicate scan gives a scene object its id later, while an id on a prefab asset would be wrong for good.
MarkDirty(Saveable)
public static void MarkDirty(Saveable saveable);
Asks for a Saveable's object and scene to be marked as changed, so that Unity saves the id it just gave itself. The work happens on the next Editor update. Ignored in Play Mode and for null.
| Parameter | Description |
|---|---|
saveable |
The Saveable whose id changed. |
Namespace RareGeometry.Shipready.Save.Editor.Diagnostics #
DiagnosticCheck #
enum in RareGeometry.Shipready.Save.Editor.Diagnostics · assembly RareGeometry.Shipready.Save.Editor
public enum DiagnosticCheck
The checks Diagnostics runs. Each issue names the check that found it.
Values
DiagnosticIssue #
class in RareGeometry.Shipready.Save.Editor.Diagnostics · assembly RareGeometry.Shipready.Save.Editor
public sealed class DiagnosticIssue
One problem Diagnostics found: which check found it, how serious it is, a plain-English message naming the object, the object or asset it is about, the matching error code, and a one-click fix where one is safe.
Properties
CanFix
public bool CanFix { get; }
Whether there is a safe one-click fix.
CheckId
public DiagnosticCheck CheckId { get; }
The check that found the problem.
Context
public Object Context { get; }
What the problem is about: a GameObject or component in an open scene, an asset, a prefab, the scene asset of a scene that is not open, or the settings asset. May be null.
DocumentationLink
public string DocumentationLink { get; }
The Troubleshooting guide entry for ErrorCode, or an empty string.
ErrorCode
public SaveErrorCode ErrorCode { get; }
Shipready error code a save or load would report for this problem, or SaveErrorCode.None.
FixCannotBeUndone
public bool FixCannotBeUndone { get; }
Whether the fix cannot be undone, such as importing a package. Fix all leaves such an issue out; its own button says so.
FixError
public string FixError { get; }
Why the last fix failed, or an empty string.
FixLabel
public string FixLabel { get; }
The label for the fix button, such as "Register the asset". Empty when there is no fix.
FixOpensScene
public bool FixOpensScene { get; }
Whether the fix has to open a scene that is not open yet. The scene is left open, unsaved, so you can check the change.
FixOpensTool
public bool FixOpensTool { get; }
Whether the fix opens a tool (the Setup Wizard) rather than changing anything itself. Such an issue stays open until the tool has done its work and Diagnostics runs again.
FollowUp
public string FollowUp { get; }
What is left to do after the fix, such as "Level 2 is open with unsaved changes: save it", or an empty string.
IsFixed
public bool IsFixed { get; }
Whether the fix has run and succeeded.
Message
public string Message { get; }
What is wrong and what it means, in plain English, naming the object.
ScenePath
public string ScenePath { get; }
The scene the problem is in, when it is in a scene that has been saved. Empty otherwise.
ScenesToSave
public IReadOnlyList<string> ScenesToSave { get; }
The scenes the fix opened and changed, which are now open with unsaved changes.
Severity
public DiagnosticSeverity Severity { get; }
How serious the problem is.
Methods
Fix()
public bool Fix();
Runs the one-click fix. The change is recorded for Undo, so Edit > Undo takes it back. Running it again after it succeeded does nothing and returns true. Refused in Play Mode, where the change would be lost. Never throws.
Returns: true when the fix succeeded; false when there is none or it failed (see FixError).
ToString()
public override string ToString();
The issue as one line, for logs.
Returns: The check, the severity and the message.
DiagnosticSeverity #
enum in RareGeometry.Shipready.Save.Editor.Diagnostics · assembly RareGeometry.Shipready.Save.Editor
public enum DiagnosticSeverity
How serious a Diagnostics issue is.
Values
| Name | Value | Description |
|---|---|---|
Info |
0 |
Worth knowing; nothing breaks. |
Warning |
1 |
Something will not be saved or loaded the way you expect. |
Error |
2 |
Saving or loading cannot work as set up. |
DiagnosticsResult #
class in RareGeometry.Shipready.Save.Editor.Diagnostics · assembly RareGeometry.Shipready.Save.Editor
public sealed class DiagnosticsResult
What one Diagnostics run found: every issue, most serious first, and how much was checked.
Properties
ErrorCount
public int ErrorCount { get; }
How many issues are errors.
FinishedUtc
public DateTime FinishedUtc { get; }
When the run finished, in UTC.
FixableCount
public int FixableCount { get; }
How many issues have a one-click fix that has not run yet.
InfoCount
public int InfoCount { get; }
How many issues are information only.
Issues
public IReadOnlyList<DiagnosticIssue> Issues { get; }
Every issue found, errors first, then warnings, then information.
Milliseconds
public double Milliseconds { get; }
How long the run took, in milliseconds.
PrefabsChecked
public int PrefabsChecked { get; }
How many prefabs with Saveables were checked.
SaveablesChecked
public int SaveablesChecked { get; }
How many Saveables were checked, in scenes and prefabs.
ScenesChecked
public int ScenesChecked { get; }
How many scenes were checked.
WarningCount
public int WarningCount { get; }
How many issues are warnings.
Methods
Count(DiagnosticCheck)
public int Count(DiagnosticCheck check);
How many issues one check found.
| Parameter | Description |
|---|---|
check |
The check. |
Returns: The count.
DiagnosticsRunner #
static class in RareGeometry.Shipready.Save.Editor.Diagnostics · assembly RareGeometry.Shipready.Save.Editor
public static class DiagnosticsRunner
Runs every Diagnostics check over a DiagnosticsScope and hands back the issues found, each with a plain-English message and, where it is safe, a one-click fix that is recorded for Undo.
Scenes that are not open are read one at a time into a preview scene (on Unity 2022.3, opened beside the open scenes for a moment and closed again unsaved), with the Editor's automatic id repair paused, so two copies of an id are never loaded together and nothing quietly gives one of them a new id and hides the problem. The open scenes are the same afterwards. Diagnostics reads; only a fix changes anything. It never switches the build target and never throws.
Methods
Run(DiagnosticsScope)
public static DiagnosticsResult Run(DiagnosticsScope scope);
Runs every check over a scope.
| Parameter | Description |
|---|---|
scope |
What to check. Null uses the default scope. |
Returns: The issues found. Never null.
Run(DiagnosticsScope, Action<string, float>)
public static DiagnosticsResult Run(DiagnosticsScope scope, Action<string, float> progress);
Runs every check over a scope, reporting progress as it goes.
| Parameter | Description |
|---|---|
scope |
What to check. Null uses the default scope. |
progress |
Called with what is being checked and a fraction from 0 to 1, and once with null at the end. The Diagnostics window shows a progress bar with it. May be null. |
Returns: The issues found. Never null.
DiagnosticsScope #
class in RareGeometry.Shipready.Save.Editor.Diagnostics · assembly RareGeometry.Shipready.Save.Editor
public sealed class DiagnosticsScope
What Diagnostics looks at. The default is the open scenes plus the project's prefabs, with the project's own settings asset and the active build target.
Shipready's own folders (Assets/RareGeometry/Shipready/Save and its test and build folders) are left out of the prefab search and of the Build Settings check, unless a scene path or an asset folder in the scope names them.
Constructors
DiagnosticsScope()
public DiagnosticsScope();
Builds the default scope: open scenes and project prefabs.
Properties
AssetFolders
public IList<string> AssetFolders { get; set; }
The folders searched for prefabs, such as Assets/Prefabs. Null searches the whole Assets folder, without Shipready's own folders.
BuildTargetOverride
public BuildTarget? BuildTargetOverride { get; set; }
The build target to check. Null uses the active build target; it is never switched.
IncludeBuildSettingsScenes
public bool IncludeBuildSettingsScenes { get; set; }
Whether every enabled scene in Build Settings is checked. Scenes that are not open are read one at a time into a preview, never opened into the Hierarchy. Off by default.
IncludeOpenScenes
public bool IncludeOpenScenes { get; set; }
Whether the scenes open in the Editor are checked. On by default.
IncludeProjectAssets
public bool IncludeProjectAssets { get; set; }
Whether prefabs (and the Saveables on them) are checked. On by default.
ScenePaths
public IList<string> ScenePaths { get; set; }
More scenes to check, by project path. Null or empty adds none.
Settings
public SaveKitSettings Settings { get; set; }
The settings to check against. Null uses the project's settings asset.
DiagnosticsWindow #
class in RareGeometry.Shipready.Save.Editor.Diagnostics · assembly RareGeometry.Shipready.Save.Editor
public sealed class DiagnosticsWindow : EditorWindow
The Diagnostics window: runs every check over the chosen scope and lists what it finds, most serious first, each with a plain-English message, the object it is about and a one-click fix where one is safe. Every fix can be undone with Edit > Undo.
Constants
MenuPath
public const string MenuPath = "Tools/Shipready/Diagnostics";
The menu command that opens Diagnostics.
Methods
Open()
public static void Open();
Opens Diagnostics and runs it.
Namespace RareGeometry.Shipready.Save.Editor.Drawers #
FieldPickerModel #
class in RareGeometry.Shipready.Save.Editor.Drawers · assembly RareGeometry.Shipready.Save.Editor
public sealed class FieldPickerModel
The Field Picker of one Saveable, without any drawing: one row per field Unity serializes on each component of the GameObject, whether it can be ticked, and why not when it cannot. The Saveable's custom Inspector draws it; tests drive it directly.
Rows list the fields the Inspector shows: public or [SerializeField], not [NonSerialized], not static, not read-only, not [HideInInspector], found by reflection on the component's class and its base classes. The Transform (the Position saver covers it), the Saveable itself, scripts that implement ISaveable (they save themselves, see SelfSavingComponents) and Unity's own components (see BuiltInComponents) get no rows; only game scripts are reflected. A field of a type Shipready cannot save, or a link to a scene object that has no Saveable, is listed but greyed out, with the reason.
Constructors
FieldPickerModel(Saveable)
public FieldPickerModel(Saveable saveable);
Builds the rows for one Saveable.
| Parameter | Description |
|---|---|
saveable |
The Saveable. Null gives an empty picker. |
Properties
BrokenFields
public IReadOnlyList<SavedField> BrokenFields { get; }
Ticked fields that have no row any more: their component was removed, the field was renamed or deleted, or it can no longer be saved. They are skipped when saving; untick them with RemoveBrokenField(SavedField).
BuiltInComponents
public IReadOnlyList<Component> BuiltInComponents { get; }
Unity's own components on the GameObject (from the UnityEngine, UnityEditor, Unity.* and TextMesh Pro assemblies), such as a Rigidbody or a Light. They get no rows: their values live in native code the Field Picker cannot reach. GetBuiltInReason(Component) says what saves them instead.
Components
public IReadOnlyList<Component> Components { get; }
The components that have rows, in order, so a view can group the rows under them.
Rows
public IReadOnlyList<FieldPickerRow> Rows { get; }
Every row, grouped by component in the order the components sit on the GameObject.
Saveable
public Saveable Saveable { get; }
The Saveable the picker edits.
SelfSavingComponents
public IReadOnlyList<Component> SelfSavingComponents { get; }
Scripts on the GameObject that implement ISaveable: they save themselves and offer no fields.
TickedCount
public int TickedCount { get; }
How many rows are ticked.
Methods
DisplayNameOf(string)
public static string DisplayNameOf(string fieldName);
The name the Inspector shows for a field, including auto-property backing fields.
| Parameter | Description |
|---|---|
fieldName |
The field's name in code. |
Returns: The display name.
FriendlyTypeName(Type)
public static string FriendlyTypeName(Type type);
A type's name as C# code writes it: int, float[], List<Item>.
| Parameter | Description |
|---|---|
type |
The type. |
Returns: The name.
GetBrokenReason(int)
public string GetBrokenReason(int index);
Why a ticked field is broken, in plain English.
| Parameter | Description |
|---|---|
index |
An index into BrokenFields. |
Returns: The reason, or an empty string for an index out of range.
GetBuiltInReason(Component)
public static string GetBuiltInReason(Component component);
Why a built-in component offers no fields, and what to use instead, in plain English.
| Parameter | Description |
|---|---|
component |
One of BuiltInComponents. |
Returns: The reason. Never null.
GetPickableFields(Type)
public static FieldInfo[] GetPickableFields(Type componentType);
The fields of a component type the Field Picker lists, base classes first, the way the Inspector orders them: public or [SerializeField], not [NonSerialized], not static, not constant, not read-only and not [HideInInspector]. The answer is cached per type.
| Parameter | Description |
|---|---|
componentType |
The component type. |
Returns: The fields. Never null.
IsUnityComponent(Type)
public static bool IsUnityComponent(Type type);
Whether a component type is one of Unity's own: its assembly is a UnityEngine, UnityEditor or Unity.* assembly, or it is part of TextMesh Pro.
| Parameter | Description |
|---|---|
type |
The component type. |
Returns: true for Unity's own components.
RemoveBrokenField(SavedField)
public bool RemoveBrokenField(SavedField field);
Unticks a broken entry from BrokenFields, recorded for Undo.
| Parameter | Description |
|---|---|
field |
The broken entry. |
Returns: true when it was removed.
SetTicked(FieldPickerRow, bool)
public bool SetTicked(FieldPickerRow row, bool ticked);
Ticks or unticks a row, recorded for Undo. A greyed-out row cannot be ticked, but a ticked one can always be unticked.
| Parameter | Description |
|---|---|
row |
A row of this picker. |
ticked |
Whether the field should be saved. |
Returns: true when the field ends up as asked.
FieldPickerRow #
class in RareGeometry.Shipready.Save.Editor.Drawers · assembly RareGeometry.Shipready.Save.Editor
public sealed class FieldPickerRow
One field in the Field Picker: a field Unity serializes on one component of the Saveable's GameObject, whether Shipready can save it, why not when it cannot, and whether it is ticked.
Properties
Component
public Component Component { get; }
The component the field belongs to.
DisplayName
public string DisplayName { get; }
The name the Inspector shows, for example Is Open.
Field
public FieldInfo Field { get; }
The field itself.
FieldName
public string FieldName { get; }
The field's name in code, as it is saved, for example isOpen.
Hint
public string Hint { get; }
A tip for a field that can be ticked, such as an asset link that needs registering. May be null.
Reason
public string Reason { get; }
Why the field cannot be ticked, in plain English: the reason FieldSaver.IsSupportedField(FieldInfo, string) gives, or that it links to an object that is not saved. Null when the field is supported.
Supported
public bool Supported { get; }
Whether Shipready can save the field, so it can be ticked.
Ticked
public bool Ticked { get; }
Whether the field is ticked on the Saveable.
TypeName
public string TypeName { get; }
The field's type in C# terms, for example int or List<ItemDefinition>.
SaveableEditor #
class in RareGeometry.Shipready.Save.Editor.Drawers · assembly RareGeometry.Shipready.Save.Editor
public sealed class SaveableEditor : UnityEditor.Editor
The Inspector of a Saveable: a one-sentence summary of what it saves, the built-in savers with a one-line explanation each, and the Field Picker, where the fields of the other components on the object are ticked to be saved. Fields Shipready cannot save are greyed out, with the reason, and a ticked field that the script's Start may set gets a dismissible warning. The id and the category sit in a collapsed Advanced section.
Methods
OnInspectorGUI()
public override void OnInspectorGUI();
Draws the Saveable's Inspector.
SaveableSummary #
static class in RareGeometry.Shipready.Save.Editor.Drawers · assembly RareGeometry.Shipready.Save.Editor
public static class SaveableSummary
The one sentence at the top of a Saveable's Inspector that says what it saves, for example "Saves position, active state and 2 fields: Is Open, Gold".
Constants
MaxNamedFields
public const int MaxNamedFields = 4;
How many field names the sentence lists before it says "and N more".
Methods
Describe(bool, bool, bool, bool, IList<string>)
public static string Describe(bool position, bool active, bool destroyed, bool physics, IList<string> fieldNames);
Builds the sentence.
| Parameter | Description |
|---|---|
position |
Whether the position saver is on. |
active |
Whether the active-state saver is on. |
destroyed |
Whether the destroyed saver is on. |
physics |
Whether the physics saver is on and the object has a Rigidbody to save. |
fieldNames |
The display names of the ticked fields that can be saved, in Inspector order. May be null. |
Returns: The sentence, without a full stop. Never null.
SaveKitSettingsEditor #
class in RareGeometry.Shipready.Save.Editor.Drawers · assembly RareGeometry.Shipready.Save.Editor
public sealed class SaveKitSettingsEditor : UnityEditor.Editor
The Inspector of Shipready's settings asset, in two tabs. Basics holds what most games touch: start-up, where saves go, slots, autosave and Console messages, in plain words. Advanced holds everything else, each in a section that starts collapsed: file names, categories, packing, encryption and backups, game updates, world objects and the scene scan. Categories and file options are edited through the same checks as the Setup Wizard and applied with their own Apply button, as one undo step.
Methods
OnInspectorGUI()
public override void OnInspectorGUI();
Draws the settings asset's Inspector.
StartAssignmentScan #
static class in RareGeometry.Shipready.Save.Editor.Drawers · assembly RareGeometry.Shipready.Save.Editor
public static class StartAssignmentScan
A quick look through a script's source for fields that its Start method sets. Shipready restores saved values after Awake and before Start, so a value set in Start overwrites the one just loaded. This is a plain text scan, not a compiler: it finds simple assignments such as isOpen = false; or this.gold += 5; in the script's own Start, and can miss or wrongly flag unusual code, so the Inspector words its warning as "may".
Methods
Describe(string, IList<string>)
public static string Describe(string scriptName, IList<string> displayNames);
The Inspector's warning for fields Start may set.
| Parameter | Description |
|---|---|
scriptName |
The script's class name, such as Chest. |
displayNames |
The display names of the fields found. |
Returns: The warning, or an empty string when displayNames is empty. Never null.
FindFieldsSetInStart(string, IList<string>)
public static List<string> FindFieldsSetInStart(string source, IList<string> fieldNames);
Lists the fields that a script's Start method appears to set.
| Parameter | Description |
|---|---|
source |
The script's C# source text. Null or empty finds nothing. |
fieldNames |
The field names to look for, as declared in the script. |
Returns: The names from fieldNames that Start sets, in the order given. Never null.
Namespace RareGeometry.Shipready.Save.Editor.FirstRun #
BugReport #
static class in RareGeometry.Shipready.Save.Editor.FirstRun · assembly RareGeometry.Shipready.Save.Editor
public static class BugReport
Report a Bug: copies a ready-to-paste report to the clipboard (kit, Unity and pipeline versions, platform, the last three saves and loads, and Diagnostics' issues), and the Start window's Help and support page shows the bug report form's address, with the fields it can fill already filled, to copy. Nothing is opened in a browser. The report holds no file paths beyond the save folder's name and no saved values. From the Start window and Tools → Shipready → Saves → Report a Bug.
Constants
MaxSaveReports
public const int MaxSaveReports = 3;
How many recent saves and loads the report lists.
MaxUrlLength
public const int MaxUrlLength = 6000;
The longest form address the report is put into; longer reports are pasted from the clipboard instead.
MenuPath
public const string MenuPath = "Tools/Shipready/Report a Bug";
The menu command.
PasteHint
public const string PasteHint = "(The full report is on your clipboard: paste it here.)";
What the form's log field says when the report is too long to fill in.
Methods
Build(BugReportFacts)
public static string Build(BugReportFacts facts);
The report text, ready to paste.
| Parameter | Description |
|---|---|
facts |
What to report. |
Returns: The report. Never null.
BuildFormUrl(string, BugReportFacts, string, int)
public static string BuildFormUrl(string formUrl, BugReportFacts facts, string report, int maxLength);
The bug report form's address with the fields GitHub issue forms can fill from the address already filled: product, versions, render pipeline, platform and, when it fits, the report itself.
| Parameter | Description |
|---|---|
formUrl |
The form's address, with its template query. |
facts |
What to fill in. |
report |
The full report text. |
maxLength |
The longest address to open; a longer report is left for the clipboard. |
Returns: The address. Never null.
CopyReport()
public static string CopyReport();
Gathers the facts, runs Diagnostics and copies the report to the clipboard. Nothing is opened: the Start window's Help and support page shows the form's address to copy.
Returns: The report that was copied. Never null.
Describe(DiagnosticIssue)
public static string Describe(DiagnosticIssue issue);
One line for a Diagnostics issue, with paths taken out.
| Parameter | Description |
|---|---|
issue |
The issue. |
Returns: The line. Never null.
Describe(SaveReport)
public static string Describe(SaveReport report);
One line for a save or load: what it was, the file's name (no folder), the time, the counts and the codes of its warnings. Never a saved value or an object's name.
| Parameter | Description |
|---|---|
report |
The report. |
Returns: The line. Never null.
Gather(bool)
public static BugReportFacts Gather(bool runDiagnostics);
Gathers what the report says about this project.
| Parameter | Description |
|---|---|
runDiagnostics |
Whether to run Diagnostics over the open scenes and the project. |
Returns: The facts. Never null.
PipelineName(RenderPipelineAsset)
public static string PipelineName(RenderPipelineAsset pipeline);
The short name of a render pipeline asset: Built-in for none, URP, HDRP, or its type's name.
| Parameter | Description |
|---|---|
pipeline |
The active pipeline asset, or null. |
Returns: The name. Never null.
Sanitize(string, string)
public static string Sanitize(string text, string userName);
Takes file paths and the user's name out of a text: drive paths and home folders become <path>, project paths <project path>, the user's name <user>.
| Parameter | Description |
|---|---|
text |
The text. |
userName |
The user's name to take out, or null. |
Returns: The cleaned text. Never null.
SystemInfoText(BugReportFacts)
public static string SystemInfoText(BugReportFacts facts);
The short system info for a question or a bug report: Shipready's version, the Unity version, the render pipeline and the platform, one per line.
| Parameter | Description |
|---|---|
facts |
The facts, from Gather(bool). |
Returns: The text. Never null.
BugReportFacts #
class in RareGeometry.Shipready.Save.Editor.FirstRun · assembly RareGeometry.Shipready.Save.Editor
public sealed class BugReportFacts
What a bug report says about the project, gathered by BugReport.Gather(bool).
Fields
Issues
public List<string> Issues;
Diagnostics' issues, already described by BugReport.Describe(DiagnosticIssue). Null when Diagnostics did not run.
KitVersion
public string KitVersion;
Shipready's version, such as 1.0.0.
Platform
public string Platform;
The operating system and the active build target.
RenderPipeline
public string RenderPipeline;
Built-in, URP, HDRP or the name of another pipeline.
SaveFolderName
public string SaveFolderName;
The save folder's name from the settings, never its full path. Empty without settings.
SaveReports
public readonly List<string> SaveReports;
The last saves and loads, newest first, already described by BugReport.Describe(SaveReport).
UnityVersion
public string UnityVersion;
The Unity editor version.
DemoTextCheck #
static class in RareGeometry.Shipready.Save.Editor.FirstRun · assembly RareGeometry.Shipready.Save.Editor
public static class DemoTextCheck
The demos' text uses TextMesh Pro. When a demo scene is opened in a project without TextMesh Pro's essential resources, its panels and buttons would be blank, so Shipready asks once per editor session whether to import them. Never in batch mode or Play Mode.
Constants
DemoScenesFolder
public const string DemoScenesFolder = "Assets/RareGeometry/Shipready/Save/Samples/Demos/Scenes/";
The folder of Shipready's demo scenes.
Methods
IsDemoScene(string)
public static bool IsDemoScene(string scenePath);
Whether a scene path is one of Shipready's demo scenes.
| Parameter | Description |
|---|---|
scenePath |
The scene's project path. |
Returns: true for a scene in the demos folder.
ShouldAsk(string, bool, bool, bool)
public static bool ShouldAsk(string scenePath, bool essentialsImported, bool askedThisSession, bool batchOrPlaying);
The rule for asking: a demo scene was opened, the essentials are missing, it has not asked in this editor session, and Unity runs with a window and not in Play Mode.
| Parameter | Description |
|---|---|
scenePath |
The opened scene. |
essentialsImported |
Whether TextMesh Pro's essential resources are in the project. |
askedThisSession |
Whether it already asked in this editor session. |
batchOrPlaying |
Whether Unity runs in batch mode or is in or entering Play Mode. |
Returns: true when Shipready should ask now.
FirstRunCheck #
enum in RareGeometry.Shipready.Save.Editor.FirstRun · assembly RareGeometry.Shipready.Save.Editor
public enum FirstRunCheck
The things the Start window checks before a first save can work.
Values
FirstRunStatus #
static class in RareGeometry.Shipready.Save.Editor.FirstRun · assembly RareGeometry.Shipready.Save.Editor
public static class FirstRunStatus
Works out the Start window's status strip from what the Editor reports: settings found, scene saved, scene in Build Settings, hotkeys on and the menu's text resources. Pure logic, so it can be tested without a scene.
Methods
CountOk(IList<FirstRunStatusItem>)
public static int CountOk(IList<FirstRunStatusItem> items);
How many of the items pass.
| Parameter | Description |
|---|---|
items |
The items from Evaluate(bool, bool, bool, bool, bool, bool). |
Returns: The number of passing checks.
Evaluate(bool, bool, bool, bool, bool)
public static List<FirstRunStatusItem> Evaluate(bool settingsFound, bool sceneSaved, bool sceneInBuildSettings, bool hasHotkeys, bool hotkeysWorkInEditor);
Evaluates the four scene and project checks, without the menu text check.
| Parameter | Description |
|---|---|
settingsFound |
Whether the project has a settings asset. |
sceneSaved |
Whether the open scene has been saved to a file. |
sceneInBuildSettings |
Whether that file is listed and switched on in Build Settings. |
hasHotkeys |
Whether the open scene has a SaveMenuHotkeys component. |
hotkeysWorkInEditor |
Whether those hotkeys work in the Editor (not switched off). |
Returns: The four items, in strip order. Never null.
Evaluate(bool, bool, bool, bool, bool, bool)
public static List<FirstRunStatusItem> Evaluate(bool settingsFound, bool sceneSaved, bool sceneInBuildSettings, bool hasHotkeys, bool hotkeysWorkInEditor, bool menuTextReady);
Evaluates every check, including whether TextMesh Pro's essential resources are in the project: without them the save menu and the demos show no text, so the strip never says "Ready" until they are.
| Parameter | Description |
|---|---|
settingsFound |
Whether the project has a settings asset. |
sceneSaved |
Whether the open scene has been saved to a file. |
sceneInBuildSettings |
Whether that file is listed and switched on in Build Settings. |
hasHotkeys |
Whether the open scene has a SaveMenuHotkeys component. |
hotkeysWorkInEditor |
Whether those hotkeys work in the Editor (not switched off). |
menuTextReady |
Whether TextMesh Pro's essential resources are imported. |
Returns: The five items, in strip order. Never null.
FirstRunStatusItem #
class in RareGeometry.Shipready.Save.Editor.FirstRun · assembly RareGeometry.Shipready.Save.Editor
public sealed class FirstRunStatusItem
One check of the Start window's status strip, with its fix.
Properties
CanFix
public bool CanFix { get; }
Whether the fix can run now. A scene that was never saved cannot be added to Build Settings yet.
Check
public FirstRunCheck Check { get; }
Which check this is.
Detail
public string Detail { get; }
One sentence on why it matters and what the fix does. Shown as a tooltip.
FixLabel
public string FixLabel { get; }
The text of the one-click fix button, such as "Save scene". Empty when the check passes.
Label
public string Label { get; }
A few words for the strip, such as "Scene saved" or "Scene not saved".
Ok
public bool Ok { get; }
Whether the check passes.
PlayModeToasts #
static class in RareGeometry.Shipready.Save.Editor.FirstRun · assembly RareGeometry.Shipready.Save.Editor
public static class PlayModeToasts
Switches the Play Mode toast on and off, and adds it to the Game view at the start of Play Mode. The toast says what each save or load did; clicking it opens the Save Inspector on that report, or Diagnostics when the operation failed without one. It is on by default, never runs in batch mode (builds, tests, command-line runs) and never exists in a build. The choice is kept per user in EditorPrefs.
Properties
Enabled
public static bool Enabled { get; set; }
Whether the toasts are shown in Play Mode. On by default.
Constants
MenuPath
public const string MenuPath = "Tools/Shipready/Play Mode Toasts";
The menu command that switches the toasts on and off.
StartWindow #
class in RareGeometry.Shipready.Save.Editor.FirstRun · assembly RareGeometry.Shipready.Save.Editor
public sealed class StartWindow : EditorWindow
The Start window: the first thing a new buyer sees. A status strip checks the five things a first save needs (settings, a saved scene, the scene in Build Settings, F5 / F9 hotkeys and the menu's text resources), each with a one-click fix, and three big choices lead through short guided flows: make objects remember their state, add a save and load menu, or save values from scripts. It opens by itself once after Shipready is imported (see StartWindowAutoOpen).
Nested types: StartWindow.Flow
Constants
MenuPath
public const string MenuPath = "Tools/Shipready/Start";
The menu command that opens the Start window.
Methods
Open()
public static void Open();
Opens the Start window, or brings it to the front.
Open(StartWindow.Flow)
public static void Open(Flow start);
Opens the Start window on one of its guided flows.
| Parameter | Description |
|---|---|
start |
The flow to show. |
OpenHelp(bool)
public static void OpenHelp(bool reportJustCopied);
Opens the Start window on its Help and support page. With reportJustCopied, the page says that a bug report is on the clipboard and shows where to paste it.
| Parameter | Description |
|---|---|
reportJustCopied |
Whether Report a Bug has just copied a report. |
StartWindow.Flow #
enum in RareGeometry.Shipready.Save.Editor.FirstRun · assembly RareGeometry.Shipready.Save.Editor
public enum Flow
The guided flows the Start window offers.
Values
StartWindowAutoOpen #
static class in RareGeometry.Shipready.Save.Editor.FirstRun · assembly RareGeometry.Shipready.Save.Editor
public static class StartWindowAutoOpen
Opens the Start window once, the first time the Editor loads Shipready in a project. It never opens in batch mode or while the game plays, and not when the project already has a settings asset. The "already shown" flag is kept per project in EditorPrefs. With ShowAtStartup on (off by default), it also opens once each time the project opens.
Properties
HasBeenShown
public static bool HasBeenShown { get; }
Whether the Start window has already opened by itself in this project.
PrefsKey
public static string PrefsKey { get; }
The EditorPrefs key that remembers the Start window was shown in this project. It includes the project's path.
ShowAtStartup
public static bool ShowAtStartup { get; set; }
Whether the Start window opens each time the project opens, as well as once after import. Off by default; the Help and support page has the switch. Kept per project in EditorPrefs.
Methods
Reset()
public static void Reset();
Forgets that the Start window was shown, so it opens again the next time scripts load.
ShouldOpen(bool, bool, bool, bool)
public static bool ShouldOpen(bool batchMode, bool playing, bool alreadyShown, bool settingsExist);
The rule for opening by itself: never in batch mode (builds, tests, command-line runs), never while the game plays, only once per project, and not when the project already has its settings.
| Parameter | Description |
|---|---|
batchMode |
Whether Unity runs without a window. |
playing |
Whether the Editor is in or entering Play Mode. |
alreadyShown |
Whether the Start window already opened by itself in this project. |
settingsExist |
Whether the project has a settings asset. |
Returns: true when the Start window should open now.
ShouldOpenNow()
public static bool ShouldOpenNow();
ShouldOpen(bool, bool, bool, bool) with the Editor's current state.
Returns: true when the Start window should open now.
Namespace RareGeometry.Shipready.Save.Editor.Generators #
DemoSceneGenerator #
static class in RareGeometry.Shipready.Save.Editor.Generators · assembly RareGeometry.Shipready.Save.Editor
public static class DemoSceneGenerator
Builds the four demo scenes and everything they use, in Samples/Demos: the scenes (QuickStartDemo, WorldDemo, WorldDemo_Cellar, GameUpdatesDemo, RecoveryDemo), the crate prefab and the four on-screen panel prefabs, one settings asset per demo with the demo Prefab, Asset and Scene Registries, and the version 1 example save, written through Shipready itself. Scenes, prefabs and assets are only ever generated, never hand-written YAML.
Safe to run again: every file is rebuilt in place, so GUIDs and the links between the files stay the same, and every saved object keeps a fixed id, so demo saves made before a rebuild still load. The example save is only written again when it is missing or no longer loads. Build Settings are never changed. Throws on any failure, which makes a batch-mode run exit with a non-zero code. Run it from Tools/Shipready/Generators/Rebuild Demo Scenes, which asks first, or with -executeMethod RareGeometry.Shipready.Save.Editor.Generators.DemoSceneGenerator.Generate.
The demo scripts live in their own assembly, which a game may delete together with the Samples folder. So that deleting them never breaks Shipready's editor code, this generator refers to them by name and sets their fields through SerializedObject; it reports clearly when they are missing.
Constants
AssetRegistryPath
public const string AssetRegistryPath = SettingsFolder + "/DemoAssetRegistry.asset";
The demos' Asset Registry. The demos link to no assets, so it is empty.
CellarScenePath
public const string CellarScenePath = ScenesFolder + "/WorldDemo_Cellar.unity";
The World demo's cellar scene.
CratePrefabPath
public const string CratePrefabPath = PrefabsFolder + "/DemoCrate.prefab";
The physics crate the World demo's dropper spawns.
DemosFolder
public const string DemosFolder = "Assets/RareGeometry/Shipready/Save/Samples/Demos";
The demos' folder.
ExampleSavePath
public const string ExampleSavePath = SaveFilesFolder + "/v1_example.save";
The version 1 save the Game Updates demo ships.
GameUpdatesHudPath
public const string GameUpdatesHudPath = PrefabsFolder + "/GameUpdatesHud.prefab";
The Game Updates demo's on-screen panel, which also carries the example save's bytes.
GameUpdatesScenePath
public const string GameUpdatesScenePath = ScenesFolder + "/GameUpdatesDemo.unity";
The Game Updates demo scene.
GameUpdatesSettingsPath
public const string GameUpdatesSettingsPath = SettingsFolder + "/DemoSaveKitSettings_GameUpdates.asset";
The Game Updates demo's settings, at save version 1.
MenuPath
public const string MenuPath = "Tools/Shipready/Generators/Rebuild Demo Scenes";
The menu command that rebuilds the demos.
OwnMenuScenePath
public const string OwnMenuScenePath = ScenesFolder + "/OwnMenuDemo.unity";
The Own Menu demo: a save menu of the game's own, built on the public API.
OwnMenuSettingsPath
public const string OwnMenuSettingsPath = SettingsFolder + "/DemoSaveKitSettings_OwnMenu.asset";
The Own Menu demo's settings.
OwnMenuToolkitScenePath
public const string OwnMenuToolkitScenePath = ScenesFolder + "/OwnMenuUIToolkitDemo.unity";
The Own Menu demo in UI Toolkit: UXML, USS and one script on the public API.
PrefabRegistryPath
public const string PrefabRegistryPath = SettingsFolder + "/DemoPrefabRegistry.asset";
The demos' Prefab Registry, holding the crate.
PrefabsFolder
public const string PrefabsFolder = DemosFolder + "/Prefabs";
The generated prefabs.
QuickStartHudPath
public const string QuickStartHudPath = PrefabsFolder + "/QuickStartHud.prefab";
The Quick Start demo's on-screen panel.
QuickStartScenePath
public const string QuickStartScenePath = ScenesFolder + "/QuickStartDemo.unity";
The Quick Start demo scene.
QuickStartSettingsPath
public const string QuickStartSettingsPath = SettingsFolder + "/DemoSaveKitSettings_QuickStart.asset";
The Quick Start demo's settings.
RecoveryHudPath
public const string RecoveryHudPath = PrefabsFolder + "/RecoveryHud.prefab";
The Recovery demo's on-screen panel.
RecoveryScenePath
public const string RecoveryScenePath = ScenesFolder + "/RecoveryDemo.unity";
The Recovery demo scene.
RecoverySettingsPath
public const string RecoverySettingsPath = SettingsFolder + "/DemoSaveKitSettings_Recovery.asset";
The Recovery demo's settings.
SaveFilesFolder
public const string SaveFilesFolder = DemosFolder + "/SaveFiles";
The shipped example save.
SaveFolderRoot
public const string SaveFolderRoot = "SaveKitDemos";
The folder, inside the persistent data path, every demo saves under.
SceneRegistryPath
public const string SceneRegistryPath = SettingsFolder + "/DemoSceneRegistry.asset";
The demos' Scene Registry, holding the five demo scenes.
ScenesFolder
public const string ScenesFolder = DemosFolder + "/Scenes";
The generated scenes.
SettingsFolder
public const string SettingsFolder = DemosFolder + "/Settings";
The generated settings assets and registries.
ToolkitFolder
public const string ToolkitFolder = DemosFolder + "/UIToolkit";
The UI Toolkit demo's layout, style sheet, theme and panel settings.
ToolkitLayoutPath
public const string ToolkitLayoutPath = ToolkitFolder + "/OwnMenuUIToolkit.uxml";
The UI Toolkit demo's layout.
ToolkitPanelSettingsPath
public const string ToolkitPanelSettingsPath = ToolkitFolder + "/OwnMenuUIToolkitPanelSettings.asset";
The UI Toolkit demo's panel settings, made by the generator.
ToolkitThemePath
public const string ToolkitThemePath = ToolkitFolder + "/OwnMenuUIToolkitTheme.tss";
The runtime theme the UI Toolkit demo's panel uses (Unity's default runtime theme).
WorldHudPath
public const string WorldHudPath = PrefabsFolder + "/WorldHud.prefab";
The World demo's on-screen panel, used in both World scenes.
WorldScenePath
public const string WorldScenePath = ScenesFolder + "/WorldDemo.unity";
The World demo's courtyard scene.
WorldSettingsPath
public const string WorldSettingsPath = SettingsFolder + "/DemoSaveKitSettings_World.asset";
The World demo's settings, shared by both World scenes.
Methods
AllScenePaths()
public static string[] AllScenePaths();
Every generated scene, in the order the Quick Start guide lists them.
Returns: A new array of project paths.
Generate()
public static void Generate();
Entry point for -executeMethod: builds every demo file and reads everything back to check it. Throws when anything is wrong. It never asks anything, so it can run in batch mode. The save menu prefab is generated first when it is missing.
GenerateFromMenu()
public static void GenerateFromMenu();
Rebuilds the demos from the menu, after asking: the generated scenes, prefabs and settings in Samples/Demos are replaced. Open scenes with changes are offered for saving first, and put back afterwards.
SaveFolderFor(string)
public static string SaveFolderFor(string demo);
The save folder of one demo, such as SaveKitDemos/World.
| Parameter | Description |
|---|---|
demo |
The demo's name. |
Returns: The folder name the demo's settings use.
MenuPrefabGenerator #
static class in RareGeometry.Shipready.Save.Editor.Generators · assembly RareGeometry.Shipready.Save.Editor
public static class MenuPrefabGenerator
Builds the player menu's prefabs and its default theme and text assets: SaveMenu, SlotCard and ConfirmDialog in UI/Prefabs, DefaultMenuTheme and DefaultMenuText in UI/Settings. Prefabs are only ever generated, never hand-written YAML.
Safe to run again: the three prefabs are overwritten in place, so their GUIDs, and every reference to them, stay the same. The theme and text assets are created only when they are missing and are never overwritten. Throws on any failure, which makes a batch-mode run exit with a non-zero code. Run it from Tools/Shipready/Generators/Rebuild Menu Prefabs, which asks first, or with -executeMethod RareGeometry.Shipready.Save.Editor.Generators.MenuPrefabGenerator.Generate.
The prefabs reference nothing outside Assets/RareGeometry/Shipready/Save: labels keep no font, so TextMesh Pro uses its default one, and the rounded shapes are made while the game runs. TextMesh Pro's essential resources must be in the project for any text to show; the generator only checks for them and says so when they are missing.
Constants
ButtonHeight
public const float ButtonHeight = 64f;
The height of every button: comfortable for touch at the reference resolution.
CardHeight
public const float CardHeight = 184f;
The height of a slot card at the 1920×1080 reference resolution.
CardPrefabPath
public const string CardPrefabPath = UiFolder + "/Prefabs/SlotCard.prefab";
The generated slot card prefab, the menu's template for each card.
DialogPrefabPath
public const string DialogPrefabPath = UiFolder + "/Prefabs/ConfirmDialog.prefab";
The generated confirmation prefab, nested inside the menu prefab.
GameMenuPrefabPath
public const string GameMenuPrefabPath = UiFolder + "/Prefabs/GameMenu.prefab";
The generated title screen and pause menu: Continue, New Game, Save, Load, Delete All Saves, Quit.
IndicatorPrefabPath
public const string IndicatorPrefabPath = UiFolder + "/Prefabs/SavingIndicator.prefab";
The generated saving indicator for builds.
MenuPrefabPath
public const string MenuPrefabPath = UiFolder + "/Prefabs/SaveMenu.prefab";
The generated menu prefab.
NotesPrefabPath
public const string NotesPrefabPath = UiFolder + "/Prefabs/SaveNotes.prefab";
The project path of the save notes prefab.
TextPath
public const string TextPath = UiFolder + "/Settings/DefaultMenuText.asset";
The generated default wording.
ThemePath
public const string ThemePath = UiFolder + "/Settings/DefaultMenuTheme.asset";
The generated default theme.
UiFolder
public const string UiFolder = "Assets/RareGeometry/Shipready/Save/UI";
The folder of the player menu.
Methods
CheckTmpEssentials()
public static bool CheckTmpEssentials();
Whether TextMesh Pro's essential resources (its default font and settings) are in the project. The menu's labels need them to show any text. When they are missing, a clear message says how to import them; the prefabs are still generated, because they keep no font of their own.
Returns: true when the TMP Settings asset exists.
Generate()
public static void Generate();
Entry point for -executeMethod: builds the three prefabs, creating the default theme and text assets only when they are missing (an existing one is never overwritten), and reads everything back to check it. Throws when anything is wrong. It never asks anything, so it can run in batch mode.
GenerateFromMenu()
public static void GenerateFromMenu();
Rebuilds the menu prefabs from the menu, after asking: any change made directly to the three generated prefabs is replaced. Prefab variants, scenes using the menu and the default theme and text assets are kept.
MenuStyleGenerator #
static class in RareGeometry.Shipready.Save.Editor.Generators · assembly RareGeometry.Shipready.Save.Editor
public static class MenuStyleGenerator
Writes the six ready-made menu styles (MenuStylePresets) as theme assets in UI/Settings/Styles. Theme assets are only ever generated, never hand-written YAML.
Safe to run again: each asset is updated in place, so its GUID stays the same, and set to exactly its style's values. Throws on any failure, which makes a batch-mode run exit with a non-zero code. Run it with -executeMethod RareGeometry.Shipready.Save.Editor.Generators.MenuStyleGenerator.Generate.
Constants
StylesFolder
public const string StylesFolder = MenuPrefabGenerator.UiFolder + "/Settings/Styles";
The folder of the ready-made styles.
Methods
Generate()
public static void Generate();
Entry point for -executeMethod: writes every style and reads them back to check them. Never asks anything, so it can run in batch mode.
Load(MenuStylePreset)
public static MenuTheme Load(MenuStylePreset preset);
The theme asset of a style, or null when the styles have not been generated.
| Parameter | Description |
|---|---|
preset |
The style. |
Returns: The asset, or null.
Namespace RareGeometry.Shipready.Save.Editor.Inspector #
SaveInspectorFile #
class in RareGeometry.Shipready.Save.Editor.Inspector · assembly RareGeometry.Shipready.Save.Editor
public sealed class SaveInspectorFile
One save in the Save Inspector's list: the main file name, its status, and the other copies that belong to it (backups, a half-written temporary file, damaged copies kept for support).
Properties
Copies
public IReadOnlyList<string> Copies { get; }
The other files that belong to this save, newest backup first: .tmp, .bak1 to .bak5, .corrupt-*.
FileName
public string FileName { get; }
The main file name, for example slot_01.save.
Status
public SaveFileStatus Status { get; }
What the file looks like: OK, damaged, encrypted, older or newer, backups, size and time.
Methods
ToString()
public override string ToString();
The file name and its status, for logs.
Returns: One line.
SaveInspectorModel #
class in RareGeometry.Shipready.Save.Editor.Inspector · assembly RareGeometry.Shipready.Save.Editor
public sealed class SaveInspectorModel
Everything the Save Inspector does, without drawing anything: it lists the saves in a folder with their status, opens one (or one of its backups) as a searchable tree, highlights the live object a tree row belongs to, shows what a save would write right now in Play Mode, and imports, exports, restores and deletes saves. Reading never moves, quarantines or writes a file. Nothing here shows a dialog; the window asks first.
Constructors
SaveInspectorModel()
public SaveInspectorModel();
Starts with no settings and no folder; set Settings and call SetFolder(string).
Properties
CanShowLive
public bool CanShowLive { get; }
Whether the Play Mode live view can be shown: the game is playing and Shipready has started.
Files
public IReadOnlyList<SaveInspectorFile> Files { get; }
The saves in the folder, by name. Backups, temporary files, damaged copies and thumbnails belong to their save.
Folder
public string Folder { get; }
The folder being looked at, as a full path.
IsLive
public bool IsLive { get; }
Whether the open tree is the Play Mode live view.
LastError
public string LastError { get; }
What went wrong last, in plain English, or an empty string.
LastLiveMilliseconds
public double LastLiveMilliseconds { get; }
How long the last live view took to capture, in milliseconds, so a view can refresh it no more often than it can afford.
LastRead
public LoadResult LastRead { get; }
The result of reading the open file, so a view can say why a file did not open.
OpenedCopy
public string OpenedCopy { get; }
The file name actually read for the open tree: the main file or one of its copies.
OpenedFile
public SaveInspectorFile OpenedFile { get; }
The save whose tree is open, or null for the live view or when nothing is open.
SelectedNode
public SaveTreeNode SelectedNode { get; }
The row last passed to Select(SaveTreeNode), or null.
Settings
public SaveKitSettings Settings { get; set; }
The settings that give the key for encrypted saves, the file extension, the current save version (for the older and newer badges) and the scene names. Null uses the defaults, which cannot open saves encrypted with a passphrase of your own.
Tree
public SaveTreeView Tree { get; }
The open tree, or null.
Methods
CloseTree()
public void CloseTree();
Closes the open tree.
DefaultFolderFor(SaveKitSettings)
public static string DefaultFolderFor(SaveKitSettings settings);
The save folder the game uses with these settings on this machine.
| Parameter | Description |
|---|---|
settings |
The settings. Null uses the default folder name. |
Returns: The full path.
Delete(SaveInspectorFile)
public bool Delete(SaveInspectorFile file);
Deletes a save: its main file, backups, temporary file and thumbnail. Damaged copies kept for support stay.
| Parameter | Description |
|---|---|
file |
A listed save. |
Returns: true when everything was deleted; otherwise LastError says why.
DescribeImportReplacement(string)
public string DescribeImportReplacement(string sourcePath);
What importing a file would do to a file of the same name already in the folder, in plain English, for the confirmation; null when nothing is there. A save's main file is kept as its newest backup, the way every save keeps the one it replaces; a backup or temporary file is simply overwritten.
| Parameter | Description |
|---|---|
sourcePath |
The file to import. |
Returns: The sentence, or null.
Export(SaveInspectorFile, string)
public bool Export(SaveInspectorFile file, string absolutePath);
Writes a readable copy of a save: indented JSON, decrypted and unpacked with the project's key. The copy is itself a valid readable save. The save is not changed.
| Parameter | Description |
|---|---|
file |
A listed save. |
absolutePath |
Where to write the copy. |
Returns: true when the copy was written; otherwise LastError says why.
Export(SaveInspectorFile, string, string)
public bool Export(SaveInspectorFile file, string copyName, string absolutePath);
Writes a readable copy of one copy of a save (a backup, say), the same way as Export(SaveInspectorFile, string).
| Parameter | Description |
|---|---|
file |
A listed save. |
copyName |
The file to export: the main file or one of its copies. |
absolutePath |
Where to write the readable copy. |
Returns: true when the copy was written; otherwise LastError says why.
ExportLive(string)
public bool ExportLive(string absolutePath);
Writes the live view, what a save would write now, as readable JSON. Play Mode only.
| Parameter | Description |
|---|---|
absolutePath |
Where to write it. |
Returns: true when it was written; otherwise LastError says why.
FindFile(string)
public SaveInspectorFile FindFile(string fileName);
The listed save with a name, or null.
| Parameter | Description |
|---|---|
fileName |
The main file name. |
Returns: The entry, or null.
FindLiveObject(string)
public static GameObject FindLiveObject(string objectId);
The GameObject of the live Saveable with an id in the open scenes, or null.
| Parameter | Description |
|---|---|
objectId |
The saved object id. |
Returns: The GameObject, or null.
FullPathOf(string)
public string FullPathOf(string name);
The full path of a file in the folder.
| Parameter | Description |
|---|---|
name |
The file name. |
Returns: The full path.
Import(string, bool)
public bool Import(string sourcePath, bool overwrite);
Copies a player's save file into the folder under its own name, for debugging. The player's file is never moved. A save already there is only replaced when overwrite is set: a main save file is then kept as its newest backup, the way the crash-safe writer keeps every file it replaces; a backup or temporary file is overwritten.
| Parameter | Description |
|---|---|
sourcePath |
The full path of the file to import. |
overwrite |
Whether a save with the same name may be replaced. |
Returns: true when imported; otherwise LastError says why.
Open(SaveInspectorFile)
public bool Open(SaveInspectorFile file);
Opens a save's main file as a tree. A file that cannot be read still shows its header when it has one.
| Parameter | Description |
|---|---|
file |
A listed save. |
Returns: true when the whole file was read.
Open(SaveInspectorFile, string)
public bool Open(SaveInspectorFile file, string copyName);
Opens one copy of a save as a tree: the main file, a backup, the temporary file or a damaged copy.
| Parameter | Description |
|---|---|
file |
A listed save. |
copyName |
The file name to read: SaveInspectorFile.FileName or one of its SaveInspectorFile.Copies. |
Returns: true when the whole file was read.
OpenLive()
public bool OpenLive();
Opens (or refreshes) the live view: what a save of every category would write right now, from SaveKit.PreviewSave(string[]). Nothing is written and the game's data is not changed.
Returns: true when the live view could be built.
Refresh()
public void Refresh();
Lists the saves in the folder again, with a fresh status for each. Nothing is changed on disk.
RestoreBackup(SaveInspectorFile)
public SaveResult RestoreBackup(SaveInspectorFile file);
Puts the newest valid backup of a damaged save back in place, through the crash-safe write. The damaged file is kept as .corrupt-<time>; the backups stay.
| Parameter | Description |
|---|---|
file |
A listed save. |
Returns: What happened. A healthy save is never replaced.
Search(string)
public void Search(string text);
Searches the open tree's keys and values, ignoring case. An empty text ends the search.
| Parameter | Description |
|---|---|
text |
The text to look for. |
Select(SaveTreeNode)
public bool Select(SaveTreeNode node);
Selects a row. When it belongs to a saved object that is in an open scene, that object is selected in the Hierarchy and pinged. An object that is not in any open scene changes nothing.
| Parameter | Description |
|---|---|
node |
The row. |
Returns: true when a live object was highlighted.
SetFolder(string)
public void SetFolder(string absolutePath);
Looks at another folder. Call Refresh() to list it.
| Parameter | Description |
|---|---|
absolutePath |
The folder's full path. |
SaveInspectorWindow #
class in RareGeometry.Shipready.Save.Editor.Inspector · assembly RareGeometry.Shipready.Save.Editor
public sealed class SaveInspectorWindow : EditorWindow
The Save Inspector: every save in the save folder with its status, any save (or backup) opened as a searchable tree, the live view of what a save would write in Play Mode, the recent save and load reports, and import, export, restore, delete and open-folder actions. A thin view over SaveInspectorModel.
Constants
MenuPath
public const string MenuPath = "Tools/Shipready/Save Inspector";
The menu command that opens the Save Inspector.
Methods
Open()
public static void Open();
Opens the Save Inspector, or brings it to the front.
ShowReport(SaveReport)
public static void ShowReport(SaveReport report);
Opens the Save Inspector with its list of recent saves and loads shown and one report opened, as the Play Mode toast does when it is clicked.
| Parameter | Description |
|---|---|
report |
The report to open. Null only opens the window. |
SaveTreeNode #
class in RareGeometry.Shipready.Save.Editor.Inspector · assembly RareGeometry.Shipready.Save.Editor
public sealed class SaveTreeNode
One row of the Save Inspector tree: file, category, scene, object or value. The tree is kept flat, in the order the rows are shown, with each row knowing its depth and parent.
Properties
ChildCount
public int ChildCount { get; }
How many rows sit directly below this one.
Depth
public int Depth { get; }
How deep the row sits: 0 for the file, 1 for a category, and so on.
Expanded
public bool Expanded { get; }
Whether the row's children are shown.
HasChildren
public bool HasChildren { get; }
Whether the row has rows below it.
Kind
public SaveTreeNodeKind Kind { get; }
What the row stands for.
Label
public string Label { get; }
What the row is called: a key, a category, a scene with its path, or an object's saved name.
ObjectId
public string ObjectId { get; }
For an object row, the object's id; otherwise null. Selecting the row highlights the live object with that id.
Parent
public SaveTreeNode Parent { get; }
The row above in the tree, or null for the file.
Path
public string Path { get; }
Where the row sits in the save, as a slash-separated path through the data, for example World/scenes/<scene id>/objects/<object id>/fields/Chest.isOpen, which SaveTree.FindPath(string) and migrations understand. The header and slot info rows start with (header) and (info).
ValueText
public string ValueText { get; }
The value as text (strings in quotes), or a short summary for a group, such as "3 values".
Methods
ToString()
public override string ToString();
The row as text, for logs and debugging.
Returns: The label and the value.
SaveTreeNodeKind #
enum in RareGeometry.Shipready.Save.Editor.Inspector · assembly RareGeometry.Shipready.Save.Editor
public enum SaveTreeNodeKind
What a row of the Save Inspector tree stands for.
Values
SaveTreeView #
class in RareGeometry.Shipready.Save.Editor.Inspector · assembly RareGeometry.Shipready.Save.Editor
public sealed class SaveTreeView
An opened save as a flat, searchable tree: file, then header and slot info, then each category, scene, object and value. Nodes holds every row; Rows holds the rows to show, which follows the expanded state and the search.
Scenes are shown with the path the Scene Registry (or the save itself) knows them by, and objects with the name they were saved with, while their ids stay one click away.
Properties
MatchCount
public int MatchCount { get; }
How many rows match the current search.
Nodes
public IReadOnlyList<SaveTreeNode> Nodes { get; }
Every row, in tree order, whether shown or not.
Rows
public IReadOnlyList<SaveTreeNode> Rows { get; }
The rows to show now: those whose parents are expanded, or, during a search, the matches and their ancestors.
SearchText
public string SearchText { get; }
The current search text, or an empty string.
Constants
HeaderPath
public const string HeaderPath = "(header)";
The path prefix of the header rows.
InfoPath
public const string InfoPath = "(info)";
The path prefix of the slot info rows.
Methods
FindByPath(string)
public SaveTreeNode FindByPath(string path);
The row with a path, or null.
| Parameter | Description |
|---|---|
path |
The path. |
Returns: The row, or null.
GetExpandedPaths()
public HashSet<string> GetExpandedPaths();
The paths of every expanded row, so a rebuilt tree can open the same way.
Returns: A new set.
IsMatch(SaveTreeNode)
public bool IsMatch(SaveTreeNode node);
Whether a row matches the current search.
| Parameter | Description |
|---|---|
node |
The row. |
Returns: true during a search when the row's label or value holds the search text.
Search(string)
public void Search(string text);
Searches keys and values, ignoring case. Matches and every row above them stay shown and expanded; other rows are hidden. An empty text ends the search.
| Parameter | Description |
|---|---|
text |
The text to look for. |
SetAllExpanded(bool)
public void SetAllExpanded(bool expanded);
Expands or collapses every row.
| Parameter | Description |
|---|---|
expanded |
Whether to expand. |
SetExpanded(SaveTreeNode, bool)
public void SetExpanded(SaveTreeNode node, bool expanded);
Shows or hides a row's children.
| Parameter | Description |
|---|---|
node |
The row. |
expanded |
Whether to show them. |
TransformSummary(SaveNode)
public static string TransformSummary(SaveNode node);
"Position (x, y, z) Rotation (x°, y°, z°) Scale (x, y, z)" for a saved transform: an object with a 3-number "p", and a 4-number "r" (a rotation) and a 3-number "s" when present. Null for anything else.
| Parameter | Description |
|---|---|
node |
A saved value. |
WithClockTime(SaveNode, string)
public static string WithClockTime(SaveNode node, string text);
A playtime in seconds with its clock time, such as "38.06 (0:00:38)". Returns text for anything that is not a number of seconds.
| Parameter | Description |
|---|---|
node |
The saved playtime. |
text |
The value's text, used when it is not a number. |
Namespace RareGeometry.Shipready.Save.Editor.MenuStyle #
MenuPreview #
class in RareGeometry.Shipready.Save.Editor.MenuStyle · assembly RareGeometry.Shipready.Save.Editor
public sealed class MenuPreview : IDisposable
Draws the save menu with made-up saves into a picture, for the Menu Style window. A copy of the menu is made in a preview scene of its own, which no camera of the game sees and which is never saved, so the open scene is never changed or marked as changed. The copy follows the theme and wording it is given, so edits show at once.
Properties
SampleSaves
public IReadOnlyList<SlotInfo> SampleSaves { get; }
The made-up saves the preview shows: an autosave, three slots with saves (one restored from a backup) and two empty slots.
Texture
public RenderTexture Texture { get; }
The last picture drawn, or null before the first Render(SaveMenu, MenuTheme, MenuText, SaveMenuMode, int) or without a graphics device.
Fields
ReferenceSize
public static readonly Vector2 ReferenceSize;
The reference resolution the menu is designed at; the picture keeps its shape.
Methods
Dispose()
public void Dispose();
Removes the copy, the preview scene and the picture.
Render(SaveMenu, MenuTheme, MenuText, SaveMenuMode, int)
public bool Render(SaveMenu source, MenuTheme theme, MenuText words, SaveMenuMode mode, int width);
Draws the menu. The copy is made again only when the menu it copies changes.
| Parameter | Description |
|---|---|
source |
The menu in the scene, or null for Shipready's own menu prefab. |
theme |
The look to show, or null for the menu's built-in default. |
words |
The wording to show, or null for the built-in English. |
mode |
Save or Load. |
width |
The picture's width in pixels; its height keeps 16:9. |
Returns: true when drawn.
RenderGameMenu(SaveMenu, MenuTheme, MenuText, int)
public bool RenderGameMenu(SaveMenu source, MenuTheme theme, MenuText words, int width);
Draws the Game Menu as a title screen, with the theme's title and the line under it.
| Parameter | Description |
|---|---|
source |
The menu in the scene, whose prefab's save menu is not drawn; only its look matters. |
theme |
The look to show, or null for the built-in default. |
words |
The wording to show, or null for the built-in English. |
width |
The picture's width in pixels; its height keeps 16:9. |
Returns: true when drawn.
RenderMessages(SaveMenu, MenuTheme, MenuText, int)
public bool RenderMessages(SaveMenu source, MenuTheme theme, MenuText words, int width);
Draws the game with the saving indicator showing "Saved" and a save note showing "Restored", where the theme puts them and the way it shows them.
| Parameter | Description |
|---|---|
source |
The menu in the scene; only its look matters. |
theme |
The look to show, or null for the built-in default. |
words |
The wording to show, or null for the built-in English. |
width |
The picture's width in pixels; its height keeps 16:9. |
Returns: true when drawn.
MenuStyleModel #
static class in RareGeometry.Shipready.Save.Editor.MenuStyle · assembly RareGeometry.Shipready.Save.Editor
public static class MenuStyleModel
What the Menu Style window does, without the window: finds the save menu in a scene or adds one, makes the game's own copy of the menu's theme and wording in the data folder, applies a ready-made style, saves the wording, and exports and imports a whole style as a .json file. Shipready's own assets are never changed: every edit goes to a copy in OwnFolder. Each action is one undo step.
Properties
LastError
public static string LastError { get; }
Why the last action did nothing, or an empty string.
OwnFolder
public static string OwnFolder { get; }
The folder the game's own menu theme and wording go to: Menu in the project's data folder.
ProjectText
public static MenuText ProjectText { get; }
The project's own wording, OwnTextName in OwnFolder, or null when it has none yet.
ProjectTheme
public static MenuTheme ProjectTheme { get; }
The project's own theme, OwnThemeName in OwnFolder, or null when it has none yet.
Constants
FileFormat
public const string FileFormat = "RareGeometry.Shipready.Save.MenuStyle";
The format a style file names, so a stranger's JSON is not read as one.
FileVersion
public const int FileVersion = 1;
The version of the style file Shipready writes.
OwnTextName
public const string OwnTextName = "MyMenuText";
The name a new copy of the wording gets.
OwnThemeName
public const string OwnThemeName = "MyMenuTheme";
The name a new copy of the theme gets.
Methods
AddMenu(Scene)
public static SaveMenu AddMenu(Scene scene);
Adds Shipready's save menu prefab to a scene, as one undo step. It stays hidden until something opens it.
| Parameter | Description |
|---|---|
scene |
A loaded scene. |
Returns: The new menu, or null; then LastError says why.
ApplyPreset(SaveMenu, MenuStylePreset)
public static bool ApplyPreset(SaveMenu menu, MenuStylePreset preset);
Gives a menu a ready-made style, as one undo step: colours, sizes and shape. The font and the layout the menu has are kept. The style goes into the menu's own theme, which is made first when the menu uses Shipready's; Shipready's style assets are never changed.
| Parameter | Description |
|---|---|
menu |
A menu in a scene, or null for the project's own theme. |
preset |
The style. |
Returns: true when applied; otherwise LastError says why.
EnsureOwnText(SaveMenu)
public static MenuText EnsureOwnText(SaveMenu menu);
The same for the wording: a copy saved as OwnTextName and assigned to the menu. With no menu, the project's own wording, made from Shipready's when there is none yet.
| Parameter | Description |
|---|---|
menu |
A menu in a scene, or null for the project's own wording. |
Returns: The wording to edit, or null; then LastError says why.
EnsureOwnTheme(SaveMenu)
public static MenuTheme EnsureOwnTheme(SaveMenu menu);
The menu's own theme, made when it has none: a copy of the theme it shows now, saved as OwnThemeName in OwnFolder and assigned to the menu, as one undo step. A theme that is already the game's own is returned as it is. With no menu, the project's own theme, made from Shipready's default when there is none yet; a menu added later gets it.
| Parameter | Description |
|---|---|
menu |
A menu in a scene, or null for the project's own theme. |
Returns: The theme to edit, or null; then LastError says why.
Export(string, MenuTheme, MenuText)
public static bool Export(string path, MenuTheme theme, MenuText words);
Writes a whole style, theme with its layout and wording, to a .json file another project can import. A font is written by its asset GUID and name; colours, sizes and words as they are.
| Parameter | Description |
|---|---|
path |
The file to write. |
theme |
The theme. |
words |
The wording, or null to leave it out. |
Returns: true when written; otherwise LastError says why.
FindMenus(Scene)
public static List<SaveMenu> FindMenus(Scene scene);
Every save menu in a loaded scene, inactive ones included, in hierarchy order.
| Parameter | Description |
|---|---|
scene |
The scene. |
Returns: The menus; empty when there are none.
Import(string, SaveMenu)
public static bool Import(string path, SaveMenu menu);
Reads a style file into a menu's own theme and wording, made first when the menu uses Shipready's, as one undo step. Values the file does not name keep the theme's; a font the project does not have is left as it is, and LastError says so.
| Parameter | Description |
|---|---|
path |
The file to read. |
menu |
A menu in a scene, or null for the project's own theme and wording. |
Returns: true when read (perhaps with a note in LastError); false when nothing changed.
ImportJson(string, SaveMenu)
public static bool ImportJson(string json, SaveMenu menu);
The same as Import(string, SaveMenu), from the file's text.
| Parameter | Description |
|---|---|
json |
A style file's text. |
menu |
A menu in a scene, or null for the project's own theme and wording. |
Returns: true when read; false when nothing changed.
IsKitAsset(UnityEngine.Object)
public static bool IsKitAsset(Object asset);
Whether an asset belongs to Shipready (it lives in Shipready's folder or a package), so the window must not change it: Shipready updates would replace the change.
| Parameter | Description |
|---|---|
asset |
An asset, or null. |
Returns: true for a kit asset; false for null, a scene object or the game's own asset.
IsOwnAsset(UnityEngine.Object)
public static bool IsOwnAsset(Object asset);
Whether an asset is the game's own, saved in the project outside Shipready, so the window may change it.
| Parameter | Description |
|---|---|
asset |
An asset, or null. |
Returns: true when it can be edited.
MakeDraft(MenuText)
public static MenuText MakeDraft(MenuText from);
A copy of some wording in memory only, for the Words tab to edit before it is saved.
| Parameter | Description |
|---|---|
from |
The wording to copy, or null for Shipready's English. |
Returns: The draft. Destroy it when done.
ResetLayout(MenuTheme)
public static bool ResetLayout(MenuTheme theme);
Puts a theme's layout back to the default list, as one undo step.
| Parameter | Description |
|---|---|
theme |
A theme that is the game's own. |
Returns: true when reset; otherwise LastError says why.
ResetLayout(SaveMenu)
public static bool ResetLayout(SaveMenu menu);
Puts the menu's own layout back to the default list, as one undo step.
| Parameter | Description |
|---|---|
menu |
A menu whose theme is the game's own, or null for the project's own theme. |
Returns: true when reset; otherwise LastError says why.
SaveText(SaveMenu, MenuText)
public static bool SaveText(SaveMenu menu, MenuText words);
Saves wording as the menu's own, as one undo step: into its own text asset (made when it uses Shipready's), which is then assigned to the menu. The wording passed in is copied, not kept.
| Parameter | Description |
|---|---|
menu |
A menu in a scene, or null for the project's own wording. |
words |
The wording to save, such as the Words tab's draft. |
Returns: true when saved; otherwise LastError says why.
TextOf(SaveMenu)
public static MenuText TextOf(SaveMenu menu);
The wording a menu shows: its own, or Shipready's default when it names none. With no menu, the wording the next menu added gets: the project's own copy, or Shipready's default.
| Parameter | Description |
|---|---|
menu |
The menu, or null for the project's wording. |
Returns: The wording, or null when even the default asset is missing.
ThemeOf(SaveMenu)
public static MenuTheme ThemeOf(SaveMenu menu);
The theme a menu shows: its own, or Shipready's default when it names none. With no menu, the theme the next menu added gets: the project's own copy, or Shipready's default.
| Parameter | Description |
|---|---|
menu |
The menu, or null for the project's look. |
Returns: The theme, or null when even the default asset is missing.
ToJson(MenuTheme, MenuText)
public static string ToJson(MenuTheme theme, MenuText words);
The style file's text for a theme and wording.
| Parameter | Description |
|---|---|
theme |
The theme. |
words |
The wording, or null. |
Returns: Indented JSON.
UseProjectLook(SaveMenu)
public static bool UseProjectLook(SaveMenu menu);
Gives a menu the project's own theme and wording (OwnThemeName and OwnTextName in OwnFolder) where it uses Shipready's or none, as one undo step. A theme or wording that is already the game's own is kept.
| Parameter | Description |
|---|---|
menu |
A menu in a scene. |
Returns: true when the menu now uses at least one of the project's own copies.
MenuStylePreset #
class in RareGeometry.Shipready.Save.Editor.MenuStyle · assembly RareGeometry.Shipready.Save.Editor
public sealed class MenuStylePreset
One ready-made look for the save menu: every colour, the sizes and the shape. The MenuStyleGenerator writes each one as a theme asset in UI/Settings/Styles, and the Menu Style window applies it to a copy in the data folder.
Properties
AssetPath
public string AssetPath { get; }
The project path of the style's theme asset.
Description
public string Description { get; }
One line on what the style looks like.
Id
public string Id { get; }
The short name the asset is named after, such as SciFi.
Name
public string Name { get; }
The name the window shows, such as Sci-fi.
Methods
ApplyTo(MenuTheme)
public void ApplyTo(MenuTheme theme);
Sets every value of a theme to this style: colours, font (TextMesh Pro's default), sizes, shape and the default layout. Nothing of the theme's earlier look is left.
| Parameter | Description |
|---|---|
theme |
The theme to change. It is not saved. |
MenuStylePresets #
static class in RareGeometry.Shipready.Save.Editor.MenuStyle · assembly RareGeometry.Shipready.Save.Editor
public static class MenuStylePresets
The six ready-made looks of the save menu: Dark (the default), Light, Fantasy, Sci-fi, Cozy and Minimal. Each uses TextMesh Pro's default font, so no font asset ships with Shipready, and each keeps readable text: Shipready's tests check the contrast of every pair of text and background colours.
Properties
All
public static IReadOnlyList<MenuStylePreset> All { get; }
Every style, Dark first.
Methods
Contrast(Color, Color)
public static float Contrast(Color foreground, Color background);
How well one colour reads on another: the WCAG contrast ratio, from 1 (the same) to 21 (black on white). Body text wants 4.5 or more; bold button and badge labels 3 or more. Alpha is ignored.
| Parameter | Description |
|---|---|
foreground |
The text's colour. |
background |
The colour behind it. |
Returns: The ratio.
CopyLook(MenuTheme, MenuTheme)
public static void CopyLook(MenuTheme from, MenuTheme to);
Copies every colour, the font, the pictures, every size, the shape and the layout from one theme to another.
| Parameter | Description |
|---|---|
from |
The theme to copy. |
to |
The theme to change. |
Find(string)
public static MenuStylePreset Find(string idOrName);
The style with an id or a name, ignoring case, or null.
| Parameter | Description |
|---|---|
idOrName |
For example SciFi or Sci-fi. |
Returns: The style, or null when there is none.
ReadabilityProblems(MenuTheme)
public static List<string> ReadabilityProblems(MenuTheme theme);
The colour pairs of a theme that read badly, in plain words: text on the panel and the cards (needs 4.5), and labels on buttons and badges (needs 3). Empty when all read well.
| Parameter | Description |
|---|---|
theme |
The theme. |
Returns: One line per pair that reads badly.
ResetToDefaults(MenuTheme)
public static void ResetToDefaults(MenuTheme theme);
Puts every value of a theme back to Shipready's defaults, the Dark style, with the default layout.
| Parameter | Description |
|---|---|
theme |
The theme to change. |
MenuStyleWindow #
class in RareGeometry.Shipready.Save.Editor.MenuStyle · assembly RareGeometry.Shipready.Save.Editor
public sealed class MenuStyleWindow : EditorWindow
Tools > Shipready > Menu Style: makes the save menu in the open scene look and read the way the game wants, without the Project window, a prefab or code. Pick one of six ready-made styles, change any colour, the font, sizes and shape, the layout (list or grid, which details show, where the panel sits) and every word, and see it at once in the preview. A style can be exported to a .json file and imported in another project. With no save menu in the open scene, every tab edits the project's own look and words, which the next menu added gets.
Every change goes to the game's own copy of the theme and wording in the data folder, never to Shipready's assets, so Shipready updates keep it. Each action is one undo step. The preview draws a copy of the menu in a scene of its own, so it never changes the open scene.
Constants
MenuPath
public const string MenuPath = "Tools/Shipready/Menu Style";
The menu command that opens the window.
Methods
Open()
public static void Open();
Opens the window, or brings it to the front.
MenuTextField #
class in RareGeometry.Shipready.Save.Editor.MenuStyle · assembly RareGeometry.Shipready.Save.Editor
public sealed class MenuTextField
One line of the menu's wording, as the Words tab shows it.
Properties
Field
public string Field { get; }
The serialized field of MenuText, such as saveTitle.
Group
public string Group { get; }
The group the line is shown in, such as Buttons.
HasPlaceholder
public bool HasPlaceholder { get; }
Whether the menu fills {0} in for this line.
Label
public string Label { get; }
The label the window shows.
Placeholder
public string Placeholder { get; }
What {0} becomes in this line, such as "the save's name", or null when the line has no {0}.
MenuTextFields #
static class in RareGeometry.Shipready.Save.Editor.MenuStyle · assembly RareGeometry.Shipready.Save.Editor
public static class MenuTextFields
Every line of the menu's wording (MenuText) in the groups the Words tab shows, with what {0} means where the menu fills it in, and a check that says when a line would show wrongly. Shipready's tests make sure no line is missing.
Properties
All
public static IReadOnlyList<MenuTextField> All { get; }
Every line, in the order the Words tab shows them.
Methods
Check(MenuTextField, string, bool)
public static string Check(MenuTextField line, string text, out bool isError);
What is wrong with a line's text, in plain words, or null when it will show as meant. A line the menu fills in must keep {0} and may not use {1} or a lone brace; a line it does not fill in shows {0} as it is written. The date format and the date language are checked against .NET's rules.
| Parameter | Description |
|---|---|
line |
The line. |
text |
Its text. |
isError |
True when the line would show wrongly; false for a warning. |
Returns: The problem, or null.
Find(string)
public static MenuTextField Find(string field);
The line for a serialized field name, or null.
| Parameter | Description |
|---|---|
field |
For example saveTitle. |
Returns: The line, or null.
MessageNames #
static class in RareGeometry.Shipready.Save.Editor.MenuStyle · assembly RareGeometry.Shipready.Save.Editor
public static class MessageNames
The plain names the editor's pickers show for the message choices.
Methods
Displays()
public static string[] Displays();
The names of DisplayAs, in order.
DisplaysWithTheme()
public static string[] DisplaysWithTheme();
The names of DisplayAs, in order, after a first choice that keeps the theme's.
Kind(MessageKind)
public static string Kind(MessageKind kind);
A kind of message's name, such as "Save failed".
| Parameter | Description |
|---|---|
kind |
The kind. |
Returns: Its name.
Positions()
public static string[] Positions();
The names of ScreenPosition, in order.
PositionsWithTheme()
public static string[] PositionsWithTheme();
The names of ScreenPosition, in order, after a first choice that keeps the theme's.
Namespace RareGeometry.Shipready.Save.Editor.Wizard #
GamePreset #
enum in RareGeometry.Shipready.Save.Editor.Wizard · assembly RareGeometry.Shipready.Save.Editor
public enum GamePreset
A kind of game the settings can be set up for in one click.
Values
GamePresetChange #
class in RareGeometry.Shipready.Save.Editor.Wizard · assembly RareGeometry.Shipready.Save.Editor
public sealed class GamePresetChange
One setting a game preset changes, with its value before and after, in plain words.
Properties
From
public string From { get; }
Its value now.
Setting
public string Setting { get; }
The setting, as the settings Inspector names it.
To
public string To { get; }
Its value after the preset.
Warning
public string Warning { get; }
What the player could notice, such as saves that stop showing in the menu, or null.
GamePresets #
static class in RareGeometry.Shipready.Save.Editor.Wizard · assembly RareGeometry.Shipready.Save.Editor
public static class GamePresets
Settings for common kinds of game, applied in one click from the Setup Wizard's first page or the settings' Basics tab. Plan(SetupWizardModel, GamePreset) lists exactly what a preset would change before anything changes; ApplyTo(SetupWizardModel, GamePreset) writes it into a SetupWizardModel, whose Apply is one undo step.
Presets only touch slots, autosave, pictures and how compact files are. They never change the encryption passphrase or key, the save folder or the file names, so every existing save stays where it is and keeps loading.
Properties
All
public static IReadOnlyList<GamePreset> All { get; }
Every preset, Custom first.
Methods
Apply(SaveKitSettings, GamePreset, string)
public static bool Apply(SaveKitSettings settings, GamePreset preset, out string error);
Applies a preset straight to a settings asset, as one undo step, for the settings' Basics tab. Only the preset's own settings are written.
| Parameter | Description |
|---|---|
settings |
The settings asset. |
preset |
The preset. |
error |
Why nothing changed, or an empty string. |
Returns: true when applied.
ApplyTo(SetupWizardModel, GamePreset)
public static void ApplyTo(SetupWizardModel model, GamePreset preset);
Writes a preset's values into a model, without applying them. The wizard's "Apply and continue", or SetupWizardModel.ApplyFilesAndSlots(), then writes them to the settings asset as one undo step. Custom changes nothing.
| Parameter | Description |
|---|---|
model |
The model. |
preset |
The preset. |
DescriptionOf(GamePreset)
public static string DescriptionOf(GamePreset preset);
One line on what the preset is for.
| Parameter | Description |
|---|---|
preset |
The preset. |
Returns: The line.
NameOf(GamePreset)
public static string NameOf(GamePreset preset);
The preset's name, such as "Story / RPG".
| Parameter | Description |
|---|---|
preset |
The preset. |
Returns: The name.
Plan(SetupWizardModel, GamePreset)
public static List<GamePresetChange> Plan(SetupWizardModel model, GamePreset preset);
What a preset would change in the settings a model holds, one line per setting whose value differs. Nothing is changed. Custom changes nothing.
| Parameter | Description |
|---|---|
model |
The settings as they are now (a wizard draft, or a model made from the settings asset). |
preset |
The preset. |
Returns: The changes; empty when the settings already match.
SaveableSuggestion #
class in RareGeometry.Shipready.Save.Editor.Wizard · assembly RareGeometry.Shipready.Save.Editor
public sealed class SaveableSuggestion
One object the Setup Wizard's scene scan thinks should remember its state, with the reason in plain English. Nothing happens to it unless it is ticked (Selected) and passed to SetupWizardModel.AddSaveables(IList<SaveableSuggestion>).
Properties
Reason
public string Reason { get; }
Why the object looks like it changes during play, for example "Has a Rigidbody".
Selected
public bool Selected { get; set; }
Whether to add a Saveable. Every suggestion starts unticked.
StateFields
public IReadOnlyList<KeyValuePair<Component, string>> StateFields { get; }
Script fields that look like state (isOpen, health, ...). They are ticked in the Field Picker when the Saveable is added, and can be unticked there later.
Target
public GameObject Target { get; }
The object to add a Saveable to.
SetupWizardModel #
class in RareGeometry.Shipready.Save.Editor.Wizard · assembly RareGeometry.Shipready.Save.Editor
public sealed class SetupWizardModel
Everything the Setup Wizard does, without drawing anything: the choices of each step, and one Apply per step that writes them into the project. The Setup Wizard window is a thin view over this class, and tests drive it directly.
The first Apply creates the settings asset and its three registries in DataFolder, which lies outside Shipready's own folder so that a Shipready update never overwrites them, and fills the registries. Every Apply is one undo group, so Edit > Undo takes a step back; undoing the first one deletes the asset files it created. Nothing here shows a dialog. Changes lists everything created or changed, for the Finish page.
Constructors
SetupWizardModel()
public SetupWizardModel();
Starts with Shipready's documented defaults, or with the project's settings asset when it already has one, so running the wizard again edits what is there.
SetupWizardModel(SaveKitSettings)
public SetupWizardModel(SaveKitSettings existing);
Starts with a given settings asset, so its Inspector edits that asset rather than the project's main one (the demos have settings of their own). Null starts with Shipready's documented defaults, as a project without settings does.
| Parameter | Description |
|---|---|
existing |
The settings asset to edit, or null. |
Properties
ActiveInputHandling
public static string ActiveInputHandling { get; }
Which input handling the project uses, in plain words, for the menu step.
AddEventSystem
public bool AddEventSystem { get; set; }
Whether AddMenuToScene(Scene) adds an EventSystem when the scene has none. On by default.
AddMenu
public bool AddMenu { get; set; }
Whether AddMenuToScene(Scene) adds the Save Menu prefab. On by default.
AddSceneToBuildSettings
public bool AddSceneToBuildSettings { get; set; }
Whether AddMenuToScene(Scene) adds the scene to Build Settings, so a build can load it, and a load of a save made in it re-opens it in a build too. On by default when the scene open as the wizard starts has been saved and is not in Build Settings yet. A scene that was never saved has no path and cannot be added; Undo takes the entry out.
AddTestHotkeys
public bool AddTestHotkeys { get; set; }
Whether AddMenuToScene(Scene) adds the F5 / F9 test hotkeys. On by default.
AutomaticFallback
public bool AutomaticFallback { get; set; }
Whether a load falls back to the newest good backup by itself when a file is damaged. On by default.
AutosaveFileCount
public int AutosaveFileCount { get; set; }
How many autosave files to rotate through, 1 to 10. Default 3.
AutosaveIntervalSeconds
public float AutosaveIntervalSeconds { get; set; }
Seconds between timed autosaves, at least 5.
AutosaveOnQuit
public bool AutosaveOnQuit { get; set; }
Whether the game autosaves when it quits or is suspended. On by default.
AutosaveOnSceneChange
public bool AutosaveOnSceneChange { get; set; }
Whether the game autosaves when it changes scene. Off by default.
AutosaveOnTimer
public bool AutosaveOnTimer { get; set; }
Whether the game autosaves on a timer. Off by default.
BackupCount
public int BackupCount { get; set; }
How many rotating backups each file keeps, 0 to 5. Default 2.
CaptureAutosaveThumbnails
public bool CaptureAutosaveThumbnails { get; set; }
Whether autosaves and the quicksave keep a small picture for the save menu. On by default.
Categories
public IReadOnlyList<SaveCategory> Categories { get; }
The categories as they will be applied, including edits not applied yet.
Changes
public IReadOnlyList<string> Changes { get; }
Everything created or changed so far, in plain English, for the Finish page.
ChecksumPolicy
public ChecksumPolicy ChecksumPolicy { get; set; }
What happens to a readable save edited by hand. Default: treated as damaged.
Compress
public bool Compress { get; set; }
Whether save data is GZip compressed. Off by default.
DataFolder
public string DataFolder { get; set; }
The project folder new assets go to: Resources/ for the settings and Registries/ for the registries.
DefaultCategory
public string DefaultCategory { get; set; }
The category a value goes into when the game names none. Default Progress.
Encrypt
public bool Encrypt { get; set; }
Whether save data is encrypted. Off by default.
ExampleGlobalFileName
public string ExampleGlobalFileName { get; }
The name the global settings file gets with the current choices, for example global.local.
ExampleSaveFolder
public string ExampleSaveFolder { get; }
The folder saves go to on this machine with the current choices.
ExampleSlotFileName
public string ExampleSlotFileName { get; }
The name slot 1 gets with the current choices, for example slot_01.save.
FileExtension
public string FileExtension { get; set; }
The extension of save files, with the dot. Default .save.
GlobalBackupCount
public int GlobalBackupCount { get; set; }
How many backups the settings file keeps, 0 to 5, when it has options of its own.
GlobalCompress
public bool GlobalCompress { get; set; }
Whether the settings file is compressed, when it has options of its own.
GlobalEncrypt
public bool GlobalEncrypt { get; set; }
Whether the settings file is encrypted, when it has options of its own. It uses the same passphrase as the slots.
GlobalFileExtension
public string GlobalFileExtension { get; set; }
The settings file's extension with the dot, when it has options of its own, such as .local to keep it out of a Steam Cloud pattern of *.save. Empty keeps the slots' extension.
GlobalPrettyPrint
public PrettyPrintMode GlobalPrettyPrint { get; set; }
When the settings file is indented, when it has options of its own.
InitialiseAutomatically
public bool InitialiseAutomatically { get; set; }
Whether Shipready starts by itself when the game runs, so saving works without code. On by default; off means the game calls SaveKit.Initialise() itself.
LastDiagnostics
public DiagnosticsResult LastDiagnostics { get; }
The result of the last RunDiagnostics(), or null.
LastError
public string LastError { get; }
Why the last Apply did nothing or stopped, or an empty string.
MenuStepHasWork
public bool MenuStepHasWork { get; }
Whether step 5 has anything to do with the current choices.
Passphrase
public string Passphrase { get; set; }
The passphrase encryption keys are made from. GeneratePassphrase() makes a strong one.
PrettyPrint
public PrettyPrintMode PrettyPrint { get; set; }
When readable save files are indented. Default: in the Editor and development builds.
ProfileFolder
public string ProfileFolder { get; set; }
An optional folder inside the save folder per player. {profile} in it is replaced at runtime by SaveKit.ProfileId, which the game sets, for example to the Steam ID; text without it is one fixed folder. Empty by default.
QuicksaveEnabled
public bool QuicksaveEnabled { get; set; }
Whether there is a quicksave slot. Off by default.
SaveFolderName
public string SaveFolderName { get; set; }
The folder inside the game's persistent data folder that saves go into. Default Saves.
SeparateGlobalFileOptions
public bool SeparateGlobalFileOptions { get; set; }
Whether the global settings file gets options of its own (the step's "different options for the settings file" toggle), instead of being written like the slots. Off by default.
Settings
public SaveKitSettings Settings { get; }
The settings asset being set up: the project's own, or the one the first Apply created. Null before that.
SlotCount
public int SlotCount { get; set; }
How many manual slots the player gets, 1 to 99. Default 10.
SlotFileNameFormat
public string SlotFileNameFormat { get; set; }
The slot file name pattern without extension; {0} is the slot number, as in slot_{0:00}.
TestHotkeysActiveIn
public HotkeysActiveIn TestHotkeysActiveIn { get; set; }
Where the test hotkeys AddMenuToScene(Scene) adds will work. Editor only by default, so F5 and F9 work while testing in Play Mode and never in a built game.
UsesEncryption
public bool UsesEncryption { get; }
Whether any file will be encrypted with the current choices, so the passphrase matters.
WorldCategory
public string WorldCategory { get; set; }
The category Saveables are saved in unless they name another. Default World.
Constants
DefaultDataFolder
public const string DefaultDataFolder = "Assets/RareGeometryData/Shipready";
Where new settings and registry assets go unless the folder is changed.
HotkeysObjectName
public const string HotkeysObjectName = "Save Menu Hotkeys";
The name of the object that holds the test hotkeys.
ProfileFolderHelp
public const string ProfileFolderHelp = "Keeps players apart on a shared PC. Write {profile}, and set SaveKit.ProfileId in code (for example to the " + "player's Steam ID) before Shipready starts, with Start Shipready by itself switched off. Text without {profile} " + "is one fixed folder. Steam fills in nothing here. Leave it empty if unsure.";
The wizard's help line for the profile folder.
Methods
AddCategory(string, SaveCategoryScope)
public bool AddCategory(string name, SaveCategoryScope scope);
Adds a category.
| Parameter | Description |
|---|---|
name |
Its name. |
scope |
Whether it lives in each slot or in one global file. |
Returns: true when added; otherwise LastError says why.
AddMenuToScene(Scene)
public bool AddMenuToScene(Scene scene);
Applies step 5 to a scene as one undo group: the Save Menu prefab (when AddMenu), an EventSystem with the input module that matches the active input handling (when the scene has none), and the F5 / F9 test hotkeys (when AddTestHotkeys), and the scene itself to Build Settings (when AddSceneToBuildSettings and the scene has been saved). Anything the scene already has is left alone.
| Parameter | Description |
|---|---|
scene |
A loaded scene. |
Returns: true when applied; otherwise LastError says why.
AddSaveables(IList<SaveableSuggestion>)
public bool AddSaveables(IList<SaveableSuggestion> suggestions);
Step 6, applied: adds a Saveable to every ticked suggestion's object, and ticks the fields the scan found that look like state, as one undo group.
| Parameter | Description |
|---|---|
suggestions |
The suggestions. Only those with SaveableSuggestion.Selected are used. |
Returns: true when applied; otherwise LastError says why.
ApplyAll()
public bool ApplyAll();
The beginner path: applies steps 1 to 4 and, when AddMenu, AddTestHotkeys or AddSceneToBuildSettings is on, step 5 to the active scene, all as one undo group.
Returns: true when everything applied; otherwise LastError says why.
ApplyCategories()
public bool ApplyCategories();
Applies step 3 (categories, default and world category) as one undo group.
Returns: true when applied; otherwise LastError says why.
ApplyFileOptions()
public bool ApplyFileOptions();
Applies step 4 (readable, compression, encryption, backups, fallback, edited files) as one undo group.
Returns: true when applied; otherwise LastError says why.
ApplyFilesAndSlots()
public bool ApplyFilesAndSlots();
Applies steps 1 and 2 (save folder, file names, start-up, slots, autosave, quicksave) as one undo group. The first Apply also creates the settings asset and its registries.
Returns: true when applied; otherwise LastError says why.
CheckCategories()
public string CheckCategories();
What is wrong with the categories, or null when they can be applied.
Returns: The problem in plain English, or null.
CheckFilesAndSlots()
public string CheckFilesAndSlots();
What is wrong with the choices of steps 1 and 2, or null when they can be applied.
Returns: The problem in plain English, or null.
CheckGlobalFileOptions()
public string CheckGlobalFileOptions();
What is wrong with the settings file's own options, or null when they can be applied.
Returns: The problem in plain English, or null.
DescribeHotkeys(HotkeysActiveIn)
public static string DescribeHotkeys(HotkeysActiveIn activeIn);
Where hotkeys set to activeIn work, in a few words.
| Parameter | Description |
|---|---|
activeIn |
Where the keys are meant to work. |
Returns: For example in the Editor only. Never null.
GeneratePassphrase()
public string GeneratePassphrase();
Makes a new random passphrase of 32 characters, puts it in Passphrase and returns it. Each call gives a different one.
Returns: The passphrase.
IsInBuildSettings(string)
public static bool IsInBuildSettings(string scenePath);
Whether a scene path is listed and switched on in Build Settings.
| Parameter | Description |
|---|---|
scenePath |
The scene's project path. |
Returns: true when a build includes the scene.
RemoveCategory(string)
public bool RemoveCategory(string name);
Removes a category. The default and the world category cannot be removed.
| Parameter | Description |
|---|---|
name |
Its name. |
Returns: true when removed; otherwise LastError says why.
RenameCategory(string, string)
public bool RenameCategory(string from, string to);
Renames a category, also as the default or world category when it was one.
| Parameter | Description |
|---|---|
from |
The current name. |
to |
The new name. |
Returns: true when renamed; otherwise LastError says why.
RunDiagnostics()
public DiagnosticsResult RunDiagnostics();
Step 7: runs Diagnostics over the open scenes and the project. Changes nothing and records nothing.
Returns: The result. Never null.
RunDiagnostics(Action<string, float>)
public DiagnosticsResult RunDiagnostics(Action<string, float> progress);
Step 7, reporting progress as it goes. Changes nothing and records nothing.
| Parameter | Description |
|---|---|
progress |
Called with what is being checked and a fraction from 0 to 1, and with null at the end. May be null. |
Returns: The result. Never null.
ScanScene(Scene, List<SaveableSuggestion>)
public void ScanScene(Scene scene, List<SaveableSuggestion> into);
Step 6: lists the objects in a scene that look like they change during play: a Rigidbody, a trigger collider (pickups), a script with fields named like state (isOpen, health, ...), a script that saves itself, or a renderer or object that starts switched off. Objects that already have a Saveable are left out. Records nothing for Undo and changes nothing.
| Parameter | Description |
|---|---|
scene |
A loaded scene. |
into |
Filled with the suggestions, all unticked, in Hierarchy order. It is cleared first. |
SceneCanBeAddedToBuildSettings(Scene)
public static bool SceneCanBeAddedToBuildSettings(Scene scene);
Whether a scene is saved to a file and not yet switched on in Build Settings.
| Parameter | Description |
|---|---|
scene |
The scene. |
Returns: true when AddSceneToBuildSettings would change something for it.
SetCategoryScope(string, SaveCategoryScope)
public bool SetCategoryScope(string name, SaveCategoryScope scope);
Moves a category into each slot or into the one global file.
| Parameter | Description |
|---|---|
name |
Its name. |
scope |
Where it lives. |
Returns: true when changed; otherwise LastError says why.
SuggestForPicked(GameObject)
public SaveableSuggestion SuggestForPicked(GameObject target);
A ticked suggestion for an object the developer picked, such as the selection in the Start window's "Make objects remember their state". The fields that look like state are found as the scene scan finds them, so AddSaveables(IList<SaveableSuggestion>) ticks them too.
| Parameter | Description |
|---|---|
target |
The picked object. |
Returns: The suggestion, or null when the object is gone, already has a Saveable, is hidden, or is part of the save menu or the input setup.
SetupWizardWindow #
class in RareGeometry.Shipready.Save.Editor.Wizard · assembly RareGeometry.Shipready.Save.Editor
public sealed class SetupWizardWindow : EditorWindow
The Setup Wizard: two short steps, where saves go and the menu with its test hotkeys, then a list of everything it created or changed. Categories, file options, game updates and the scene scan live in the Advanced tab of the settings asset's Inspector. A thin view over SetupWizardModel; each "Apply and continue" is one undo step.
Constants
MenuPath
public const string MenuPath = "Tools/Shipready/Setup Wizard";
The menu command that opens the wizard.
Methods
Open()
public static void Open();
Opens the Setup Wizard, or brings it to the front.
TmpEssentials #
static class in RareGeometry.Shipready.Save.Editor.Wizard · assembly RareGeometry.Shipready.Save.Editor
public static class TmpEssentials
TextMesh Pro's essential resources (its default font and settings), which the save menu's text needs. They live in the game's project, not in Shipready, so the Setup Wizard checks for them and hands over to TextMesh Pro's own importer.
Properties
AreImported
public static bool AreImported { get; }
Whether the TMP Settings asset is in the project, which means the essentials were imported.
EssentialsPackagePath
public static string EssentialsPackagePath { get; }
The full path of TextMesh Pro's essential resources package in this project, or an empty string when it cannot be found.
Constants
ImportMenuPath
public const string ImportMenuPath = "Window/TextMeshPro/Import TMP Essential Resources";
The menu command TextMesh Pro registers for its importer, in Unity 2022.3 and Unity 6 alike.
Methods
Import()
public static bool Import();
Starts TextMesh Pro's own import of its essential resources, through the menu command it registers. Unity then shows its package import window; click Import there.
Returns: true when TextMesh Pro's importer was started.
ImportNow()
public static bool ImportNow();
Imports TextMesh Pro's essential resources straight away, without a window to click through: TextMesh Pro's own package, imported as it ships. When the package cannot be found, falls back to Import(), which shows TextMesh Pro's import window.
Returns: true when the import was started.
Namespace RareGeometry.Shipready.Save.Editor.Setup #
RequiredPackages #
static class in RareGeometry.Shipready.Save.Editor.Setup · assembly RareGeometry.Shipready.Save.Editor.Setup
public static class RequiredPackages
Tells the developer which Unity packages Shipready's save menu, editor tool windows and demos need, and how to install them: uGUI (com.unity.ugui) and TextMesh Pro, which is part of uGUI from Unity 2023.2 and the separate com.unity.textmeshpro package in Unity 2022.3. Shipready never installs, updates or removes a package itself; the developer does that in the Package Manager.
This class sits in its own small editor assembly, RareGeometry.Shipready.Save.Editor.Setup, which references nothing else of Shipready and compiles only while one of those packages is missing. Until they are installed, Shipready's runtime (SaveKit) and its core editor services in RareGeometry.Shipready.Save.Editor.Core (saved ids, registry upkeep and the migration link file) compile and keep working; the save menu, the Start window, the Setup Wizard, the Save Inspector and Diagnostics windows and the demos wait, so importing Shipready never ends in compile errors.
While a package is missing, this class logs one warning per editor session (not on every script reload); it never opens a dialog by itself. Tools → Shipready → Saves → Required Packages shows the same explanation, with a button that opens the Package Manager. A player build stops with the same message, because the save menu and the demos would be missing from it. Nothing is shown in batch mode, but the build check applies there too.
Constants
MenuPath
public const string MenuPath = "Tools/Shipready/Required Packages";
The menu command that explains which packages are missing and opens the Package Manager.
TextMeshProPackage
public const string TextMeshProPackage = "com.unity.textmeshpro";
The TextMesh Pro package of Unity 2022.3. From Unity 2023.2, TextMesh Pro is part of uGUI.
UguiPackage
public const string UguiPackage = "com.unity.ugui";
The uGUI package, which the save menu is built with. From Unity 2023.2 it includes TextMesh Pro.
Methods
GetBuildMessage()
public static string GetBuildMessage();
The message a player build fails with while a package is missing: what is missing, what it means and how to install it. Empty when nothing is missing.
Returns: The message, or an empty string when every package Shipready needs is installed.
GetMissing()
public static string[] GetMissing();
The packages the project still needs, by package name: com.unity.ugui when uGUI is missing, and in Unity 2022.3 com.unity.textmeshpro when TextMesh Pro is missing. In Unity 2023.2 and newer, TextMesh Pro comes with uGUI 2.0, so com.unity.ugui covers both.
Returns: A new array, empty when nothing is missing. Never null.
HowToInstall(string[])
public static string HowToInstall(string[] missing);
Step-by-step instructions for installing packages in the Package Manager.
| Parameter | Description |
|---|---|
missing |
The missing packages, as GetMissing() returns them. |
Returns: The instructions. Never null.
OpenPackageManager()
public static void OpenPackageManager();
Opens Unity's Package Manager window on the first missing package, so the developer can install it there. It only opens the window: nothing is installed, updated or removed.