Saving Lists using Read/Write

Discussion and help for Easy Save 3

Saving Lists using Read/Write

Postby cragggle » Sun Aug 18, 2019 12:35 am

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?
cragggle
 
Posts: 11
Joined: Mon Jun 10, 2019 4:05 am

Re: Saving Lists using Read/Write

Postby Joel » Sun Aug 18, 2019 3:48 pm

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
Joel Tebbett @ Moodkie Interactive
Twitter - Unity - LinkedIn
User avatar
Joel
Moodkie Staff
 
Posts: 2476
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving Lists using Read/Write

Postby cragggle » Sun Aug 18, 2019 5:02 pm

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.
cragggle
 
Posts: 11
Joined: Mon Jun 10, 2019 4:05 am

Re: Saving Lists using Read/Write

Postby Joel » Sun Aug 18, 2019 7:56 pm

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
Joel Tebbett @ Moodkie Interactive
Twitter - Unity - LinkedIn
User avatar
Joel
Moodkie Staff
 
Posts: 2476
Joined: Wed Nov 07, 2012 10:32 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron