Edit: This is my current save set up, so in a build none of this will save at all or will it? I’m kind of a beginner with Scriptable Objects outside of what we were taught in the courses. You said read only so I’m guessing it means it won’t save the data correctly or at all. Is my set up redundant atm?
[System.Serializable]
struct SaveData
{
public List<bool> skillUnlocked;
public List<int> cost;
public List<int> skillID;
public List<int> levelCap;
public List<int> level;
public int points;
}
public object CaptureState()
{
SaveData data = new SaveData();
data.points = availablePoints;
data.cost = new List<int>();
data.skillID = new List<int>();
data.level = new List<int>();
data.levelCap = new List<int>();
data.skillUnlocked = new List<bool>();
for (int i = 0; i < skillsList.Count; i++)
{
data.cost.Add(skillsDictionary[i].RequiredPointsToUnlock);
data.skillUnlocked.Add(skillsDictionary[i].Unlocked);
data.skillID.Add(skillsDictionary[i].SkillID);
data.level.Add(skillsDictionary[i].SkillLevel);
data.levelCap.Add(skillsDictionary[i].SkillCap);
}
return data;
}
public void RestoreState(object state)
{
SaveData loadData = (SaveData)state;
availablePoints = loadData.points;
for (int i = 0; i < skillsList.Count; i++)
{
skillsDictionary[i].RequiredPointsToUnlock = loadData.cost[i];
skillsDictionary[i].Unlocked = loadData.skillUnlocked[i];
skillsDictionary[i].SkillID = loadData.skillID[i];
skillsDictionary[i].SkillLevel = loadData.level[i];
skillsDictionary[i].SkillCap = loadData.levelCap[i];
}
}