Basic Usage
Preparing a Data Class
Two requirements for the class you want to serialize with MemoryPack:
[MemoryPackable]attributepartialkeyword
The generic constraint on
QuickSave<T>iswhere T : class. Structs are not supported.
Creating an Instance via Builder
When Build() is called, the save directory (persistentDataPath/quicksave/) is created if it doesn't exist. Subsequent calls to SaveData / LoadData incur no directory check overhead.
SaveData
The file is saved at {persistentDataPath}/quicksave/InventoryData.acqs.
HasSaveData
Check whether the save file exists before loading.
LoadData
- Returns
nullif the file doesn't exist. - Throws
InvalidDataExceptionif the file exists but deserialization fails — allowing you to distinguish between a missing file and a corrupted one.
DeleteData
Does nothing if the file doesn't exist. No exception is thrown.
Deleting Saves in the Editor
Use the Unity Editor menu Achieve > Delete Save to delete all .acqs files in the quicksave/ directory. A confirmation dialog is shown before deletion.