Page 1 of 1

Trouble loading bool

Posted: Thu May 09, 2019 11:59 pm
by DrNRG
Hi,

I just grabbed Easy Save on the asset store, I've had success with saving and loading floats and ints, but am having trouble with loading bools.

I used Debug.Log("Persistent Path" + Application.persistentDataPath); to locate the .es3 file, upon opening it and reading it, I can verify that the bool is saving to the correct value upon using ES3.Save<bool>("MyBool", MyBool); in the OnApplicationQuit() method.

But, when I use: ES3.Load<bool>("MyBool", MyBool); in the start function, it isn't overriding the value of the bool in the script. I've tested it every which way, and it seems that ES3.Load<bool>("MyBool", MyBool); just doesn't seem to be working for me.

Re: Trouble loading bool

Posted: Fri May 10, 2019 5:55 am
by Joel
Hi there,

You need to assign the return value of the ES3.Load method back to your variable. I.e.
MyBool = ES3.Load<bool>("MyBool");
Note that the second parameter of the ES3.Load method is the default value returned if no data was found to load from.

All the best,
Joel