Hello, I don´t know why but EasySave2 is reading wrong data.
I´m saving as (MADNESS):
writer.Write(data.currentMode);
and I´m loading (HORDE, is other mode):
data.currentMode = reader.Read<Globals.GameModeEnum>();
Im following with breakpoints, and the last saved is MADNESS (As it should) :S
Modes:
//Game mode
public enum GameModeEnum
{
Madness,
Horde,
HordeParallel,
FloorIsLava
}
Thanks !
Easy Save loading wrong info
Re: Easy Save loading wrong info
Hi there,
I can't seem to make sense of what you're doing. Please could you provide me with a test script so I can try to replicate this at my end?
Also please could you let me know the version of Unity you are using.
All the best,
Joel
I can't seem to make sense of what you're doing. Please could you provide me with a test script so I can try to replicate this at my end?
Also please could you let me know the version of Unity you are using.
All the best,
Joel
Re: Easy Save loading wrong info
I found the problem is over here:
Write.Write(1) changes mode to the mode 1...
Write.Write(1) changes mode to the mode 1...
Code: Select all
public class ES2UserType_GlobalsGameModeEnum : ES2Type
{
public override void Write(object obj, ES2Writer writer)
{
Globals.GameModeEnum data = (Globals.GameModeEnum)obj;
// Write the version number, which you increment whenever you add fields to the ES2Type.
writer.Write(1);
// Add your writer.Write calls here.
writer.Write((int)data);
}
public override object Read(ES2Reader reader)
{
Globals.GameModeEnum data = (Globals.GameModeEnum)reader.reader.ReadInt32();
// Read the version number.
int fileVersion = reader.Read<int>();
// These are fields we added in version 2.
if (fileVersion >= 1)
{
//data.vibrate = reader.Read<System.Boolean>();
}
return data;
}
/* ! Don't modify anything below this line ! */
public ES2UserType_GlobalsGameModeEnum():base(typeof(Globals.GameModeEnum)){}
}
Re: Easy Save loading wrong info
Hi there,
If you're writing an enum as the name suggests, you do not need to create a custom ES2Type; all enums are natively supported.
All the best,
Joel
If you're writing an enum as the name suggests, you do not need to create a custom ES2Type; all enums are natively supported.
All the best,
Joel
Re: Easy Save loading wrong info
Yes, Thanks for support.
It has been fixed
It has been fixed
Re: Easy Save loading wrong info
Ahh glad to hear it. Let me know if you run into any other issues
All the best,
Joel
All the best,
Joel