Page 1 of 1
Saving Lists using Read/Write
Posted: Sun Aug 18, 2019 12:35 am
by cragggle
Trying to save a GameObject list using
Code: Select all
public List<GameObject> objs;
writer.Write(objs, "OBJS");
List<GameObject> objs = reader.ReadList<GameObject>("OBJS");
//Also tried
objs = reader.ReadList<GameObject>("OBJS");
But having no luck.
I have found several other posts regarding lists but none seem to help.
Am i missing anything?
Re: Saving Lists using Read/Write
Posted: Sun Aug 18, 2019 3:48 pm
by Joel
Hi there,
Are you using Easy Save 3? The ES3Writer/Reader classes are internal in Easy Save 3 and should not be used. Instead you should use ES3File, which provides all of the benefits of a writer, but with a much simpler API:
https://docs.moodkie.com/easy-save-3/es ... g-es3file/
All the best,
Joel
Re: Saving Lists using Read/Write
Posted: Sun Aug 18, 2019 5:02 pm
by cragggle
Joel wrote:Hi there,
Are you using Easy Save 3? The ES3Writer/Reader classes are internal in Easy Save 3 and should not be used. Instead you should use ES3File, which provides all of the benefits of a writer, but with a much simpler API:
https://docs.moodkie.com/easy-save-3/es ... g-es3file/
All the best,
Joel
I'm sure I had my project set up to use that system before, then I read somewhere that if I have lots of variables to save the reader and writer is more efficient. Can't remember where though.
I currently have over 100 variables which I am saving and loading for a mobile game.
Would you recommend I switch it all over to ES3File?
Also if so, could you give me the correct syntax for that method to save and load a List<GameObject>.
[EDIT]
Figured out how to do this using
Code: Select all
file.Save<List<GameObject>>("savedList", list);
If you can just confirm that it's overall more efficient for me to switch to es3file completely would greatly appreciate it.
Thanks.
Re: Saving Lists using Read/Write
Posted: Sun Aug 18, 2019 7:56 pm
by Joel
Hi there,
ES3File is intended for situations where you have many variables, so it works well in this situation. Just to clarify, ES3Writer/Reader should not be used.
All the best,
Joel