QuickSave leverages Cysharp's MemoryPack to serialize and deserialize data into binary files for storage and retrieval. For additional data security, you can install Data Protector to enable compression and encryption.
Choose one of the following installation methods:
Note: Check the version after # in the GitHub URL for the latest changes listed in the Changelog.
Getting Started: Install MemoryPack via NuGetForUnity
- Install NuGetForUnity according to the instructions in the repository.
- With NuGetForUnity installed, add MemoryPack to your project.
- Please install MemoryPack to use this package.
This setup prepares MemoryPack for seamless binary serialization and deserialization within Unity.
- Open UPM and click the + button in the top left.
- Select Install package from git URL....
- Enter
https://github.com/achieveonepark/QuickSave.git#1.0.0
and click Install.
Open the manifest.json file in your Unity project’s Packages folder. Add the following line under dependencies:
"com.achieve.quick-save": "https://github.com/achieveonepark/QuickSave.git#1.0.0"
QuickSave.Builder | Creates a new QuickSave instance.
QuickSave.SaveData<T> | Saves data of type T as a binary file to persistentDataPath.
QuickSave.LoadData<T> | Loads data of type T from persistentDataPath.
[MemoryPackable]
public partial class Monster
{
public int HP;
public long Attack;
public long Defense;
}
using Achieve.QuickSave
public class DataManager : MonoBehaviour
{
QuickSave<Monster> data;
void Start()
{
Monster monster = new Monster();
monster.HP = 10000;
monster.Attack = 10000;
monster.Defense = 100000;
data = new QuickSave<Monster>.Builder()
.UseEncryption("ejrjejrtlq3mgfeq") // Optional: Use if Data Protector is added
.UseVersion(55) // Sets the version for the data
.Build();
// Save data
data.SaveData(monster);
// Load data from saved file
var loadedMonster = data.LoadData();
}
}