I have a problem with saving a game session. Here's some JSON fragment from the saved data.
"boughtSpells":[{"instanceID":13864},{"instanceID":13421}]
And here's some code.
[CreateAssetMenu(fileName = "New Spell Pattern", menuName = "SpellPattern")]
[System.Serializable]
public class SpellPattern : ScriptableObject {
public string spellName;
[TextArea]
public string spellDescription;
}
Game data model.
[Serializable]
public class GameData
{
public List<SpellPattern> boughtSpells;
}
I think it saves a reference of Unity's Scriptable Object ID(which is unique, but not persistent), rather than serializing the data in it. I need to serialize the data correctly, but I have no idea how to make it with Unity's Scriptable Objects, but at the same time I don't want to change the architecture of these Scriptable Objects.