I've also tried it without the /. Data.current is an instance of the Data class which contains all my data I want to save - I have it all set up with the automatic class hookup function.
I am using a webplayer build with the default (playerprefs) saving. (I'm making a simple idle game that doesn't need extensive server-side data managing)
I decided to try to re-do the Auto Class in the 'Manage Types' to see if that fixed it, and it did for Data. But now I'm getting the same error for one of my other classes (Data contains 3 dictionaries, one of each other class). When I tried to redo the ShipValues information for Easy Save it did not fix it.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using IdleArtificer;
public class ES2UserType_IdleArtificerShipValues : ES2Type
{
public override void Write(object obj, ES2Writer writer)
{
IdleArtificer.ShipValues data = (IdleArtificer.ShipValues)obj;
// Add your writer.Write calls here.
writer.Write(data.id);
writer.Write(data.stringMode);
writer.Write(data.active);
writer.Write(data.updateCycle);
writer.Write(data.travelTime);
writer.Write(data.modeTime);
writer.Write(data.store);
writer.Write(data.rankProgress);
writer.Write(data.payment);
writer.Write(data.tribute);
writer.Write(data.resTribute);
writer.Write(data.earnTribute);
writer.Write(data.deliverTribute);
writer.Write(data.rank);
writer.Write(data.nextRank);
writer.Write(data.rankMultiplier);
writer.Write(data.awayTime);
writer.Write(data.production);
writer.Write(data.locked);
}
public override object Read(ES2Reader reader)
{
IdleArtificer.ShipValues data = new IdleArtificer.ShipValues();
// Add your reader.Read calls here and return your object.
data.id = reader.Read<System.String>();
data.stringMode = reader.Read<System.String>();
data.active = reader.Read<System.Boolean>();
data.updateCycle = reader.Read<System.Single>();
data.travelTime = reader.Read<System.Single>();
data.modeTime = reader.Read<System.Single>();
data.store = reader.Read<IdleArtificer.ExponentNumber>();
data.rankProgress = reader.Read<IdleArtificer.ExponentNumber>();
data.payment = reader.Read<IdleArtificer.ExponentNumber>();
data.tribute = reader.Read<IdleArtificer.ExponentNumber>();
data.resTribute = reader.Read<IdleArtificer.ExponentNumber>();
data.earnTribute = reader.Read<IdleArtificer.ExponentNumber>();
data.deliverTribute = reader.Read<IdleArtificer.ExponentNumber>();
data.rank = reader.Read<System.Int32>();
data.nextRank = reader.Read<IdleArtificer.ExponentNumber>();
data.rankMultiplier = reader.Read<System.Double>();
data.awayTime = reader.Read<System.Single>();
data.levelUp = reader.Read<System.Boolean>();
data.production = reader.Read<IdleArtificer.ExponentNumber>();
data.locked = reader.Read<System.Boolean>();
return data;
}
/* ! Don't modify anything below this line ! */
public ES2UserType_IdleArtificerShipValues():base(typeof(IdleArtificer.ShipValues)){}
}
EDIT: In case it matters, the IdleArtificer.ExponentNumber class only saves an Int and a Double. It represents numbers that are multiplied by powers of 100 (idle games tend to grow exponentionally with the resources collected)
Try going to Assets > Easy Save 2 > Manage Types ... and pressing the Refresh ES2Init button at the top. Sometimes when updating the Asset Store accidentally suppresses the script which automatically updates the ES2Init file. The errors you're getting would definitely point at this.
If this doesn't fix your problem, would you be able to send me the following so I can try to replicate the problem:
Your Data class file.
A copy of the ES2Init.cs file found in Assets/Easy Save 2/.
That fixed it, thanks. I thought that button was for if I added a new class and it wasn't showing up on the list and it needed to repopulate the list.
I'm having other errors now from when I redid my ShipValues saving ( I saved values that I shouldn't have .. or didn't save something I should have.. and it's throwing errors at me in every direction) but that has more to do with my bad coding than your software.
Thanks for your help!
(EDIT - yup.. looks like I saved a public enum, which gummed up the works. I had to parse the enums as strings in order to get them to save well and I clicked the wrong thing when I was trying to work around the other error.)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using IdleArtificer;
public class ES2UserType_IdleArtificerShipValues : ES2Type
{
public override void Write(object obj, ES2Writer writer)
{
IdleArtificer.ShipValues data = (IdleArtificer.ShipValues)obj;
// Add your writer.Write calls here.
writer.Write(data.id);
Debug.Log ("Wrote: "+data.id);
writer.Write(data.stringMode);
writer.Write(data.active);
writer.Write(data.updateCycle);
writer.Write(data.travelTime);
writer.Write(data.modeTime);
writer.Write(data.store);
writer.Write(data.rankProgress);
writer.Write(data.payment);
writer.Write(data.tribute);
writer.Write(data.resTribute);
writer.Write(data.earnTribute);
writer.Write(data.deliverTribute);
writer.Write(data.rank);
writer.Write(data.nextRank);
writer.Write(data.rankMultiplier);
writer.Write(data.awayTime);
writer.Write(data.production);
writer.Write(data.locked);
}
public override object Read(ES2Reader reader)
{
IdleArtificer.ShipValues data = new IdleArtificer.ShipValues();
// Add your reader.Read calls here and return your object.
data.id = reader.Read<System.String>();
Debug.Log ("Read: "+data.id);
data.stringMode = reader.Read<System.String>();
data.active = reader.Read<System.Boolean>();
data.updateCycle = reader.Read<System.Single>();
data.travelTime = reader.Read<System.Single>();
data.modeTime = reader.Read<System.Single>();
data.store = reader.Read<IdleArtificer.ExponentNumber>();
data.rankProgress = reader.Read<IdleArtificer.ExponentNumber>();
data.payment = reader.Read<IdleArtificer.ExponentNumber>();
data.tribute = reader.Read<IdleArtificer.ExponentNumber>();
data.resTribute = reader.Read<IdleArtificer.ExponentNumber>();
data.earnTribute = reader.Read<IdleArtificer.ExponentNumber>();
data.deliverTribute = reader.Read<IdleArtificer.ExponentNumber>();
data.rank = reader.Read<System.Int32>();
data.nextRank = reader.Read<IdleArtificer.ExponentNumber>();
data.rankMultiplier = reader.Read<System.Double>();
data.awayTime = reader.Read<System.Single>();
data.levelUp = reader.Read<System.Boolean>();
data.production = reader.Read<IdleArtificer.ExponentNumber>();
data.locked = reader.Read<System.Boolean>();
return data;
}
/* ! Don't modify anything below this line ! */
public ES2UserType_IdleArtificerShipValues():base(typeof(IdleArtificer.ShipValues)){}
}
The Debug.Log on the write side works, but when it loads it's like it's loading either a null or an empty string. It puts out "Read:"
I checked all my other classes to make sure that it's loading and saving the same number and types of values (otherwise the bit stream is out of sync.. I don't know what the proper term is.. but you know what I mean I hope)
EDIT: It looks like it reads one, but then fails to read any others. When I double-checked the saving info it definitely does not save any empty or null strings. Very odd.
Found it! It was trying to load a boolean that it wasn't saving. (Seeing that it loaded the first one correctly made me realise that there _must_ be something wrong with that class's saving as it'd be trying to load a dictionary.) It's the 'LevelUp' boolean - something I toggle to tell the UI to play the LevelUp message. I realised after I auto-created the class data I didn't need it and missed it on the bottom half.
Sorry for rambling at you with my problems that have nothing to do with your code but mine!