Trouble loading bool

Easy Save 2 has been replaced by Easy Save 3, so is no longer supported.
Locked
DrNRG
Posts: 1
Joined: Thu May 09, 2019 11:49 pm

Trouble loading bool

Post 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.
User avatar
Joel
Moodkie Staff
Posts: 4824
Joined: Wed Nov 07, 2012 10:32 pm

Re: Trouble loading bool

Post 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
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Locked