Optimal Save Method

Discussion and help for Easy Save 3
Post Reply
Ell223
Posts: 10
Joined: Thu Jan 07, 2021 2:42 pm

Optimal Save Method

Post by Ell223 »

Hello,

I am looking for guidance on what the optimal way of saving an object is.

My current issue is that I am trying to save a list of prefab instances. I can save this list directly with e.g:

Code: Select all

ES3.Save("citizens", citizenGameobjects;
But this leads to a lot of repeated and redundant information in the save file, as it's saving the child objects, their transforms, etc- which are exactly the same for each prefab instance. I'd rather not turn off 'Save Gameobject Children' as I'm relying on this for other objects.

I then changed the code to only save the required components from the object, e.g:

Code: Select all

int index = 0;
foreach (Citizen citizen in Find.instance.setCitizens.Items)
{
    ES3.Save(string.Format("citizen{0}storage", index), citizen.GetComponent<Storage>());
    ES3.Save(string.Format("citizen{0}animatorController", index), citizen.GetComponent<AnimatorController>());
    ES3.Save(string.Format("citizen{0}citizen", index), citizen);
    ES3.Save(string.Format("citizen{0}transform", index), citizen.transform);
    index++;
}

ES3.Save("citizenAmount", index);
And this works also, with a much smaller save file, but the save time goes way up.
The first method takes 0.17s, and the second takes 3.26s.

Is there a better way to do this, that has the quicker save time, without the repeated save information? Or is my option to turn off 'Save Gameobject Children' and rework the other save objects? But this could lead to the other objects taking up the extra time, as their child objects would need saving seperately.

Thanks,
Elliott
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Optimal Save Method

Post by Joel »

Hi Elliott,

We have a guide here regarding improving save time in this situation:
https://docs.moodkie.com/easy-save-3/es ... rformance/

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Ell223
Posts: 10
Joined: Thu Jan 07, 2021 2:42 pm

Re: Optimal Save Method

Post by Ell223 »

:oops: Doh! Sorry, somehow missed this!

Thanks.
Post Reply