GameSaver is a package to simplify saving game data in Unity.
- Create a class that holds your save data states.
- Populate your object with data.
public class SaveData
{
public int level;
public string levelNumberString;
public Dictionary<string, int> numberOfEnemies = new Dictionary<string, int>();
public List<string> playerSkins = new List<string>();
}
var saveDataObject = new SaveObject
{
level = 5,
levelNumberString = "69",
numberOfEnemies = new Dictionary<string, int>{{"L1Enemy", 5}, {"L2Enemy", 2}},
playerSkins = new List<string>{"skin1", "skin2"}
};
Use the following snipped to create a save file called "save1"
SaveManager.Save<SaveData>("SaveDataFile", saveDataObject);
Use the following snipped to load a save file called "save1"
var loadObject = Load<SaveData>("SaveDataFile");
Date | Version |
---|---|
February 9th, 2023 | Version 0.0.2 |