FormatException
Posted: Wed Aug 14, 2019 10:10 pm
Im trying to save a simple List<int> but it keeps throwing this exception when im trying to load it : [*]FormatException: Expected '}', found '0'.[/*]
Am i missing something obvious here?
Here are my Save / Load methods. Load() is being called on Start() and Save() is on OnApplicationQuit().
And here is what it outputs. Seems to save just fine?
Am i missing something obvious here?
Here are my Save / Load methods. Load() is being called on Start() and Save() is on OnApplicationQuit().
Code: Select all
public void Save()
{
List<int> ids = new List<int>();
for (int i = 0; i < items.Count; i++)
{
ids.Add(items[i].id);
}
ES3.Save<List<int>>("Inventory", ids);
}
Code: Select all
public void Load()
{
List<int> ids = new List<int>();
if (ES3.FileExists())
{
if (ES3.KeyExists("Inventory"))
{
ES3.LoadInto<List<int>>("Inventory", ids);
}
}
}
Code: Select all
{"Inventory":{"__type":"System.Collections.Generic.List`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]],mscorlib","value":[0,2,1]}}