Page 1 of 1

Auto Save every 5 minutes

Posted: Fri Nov 12, 2021 10:19 pm
by syu15
Hello,
Right now I am only saving my prefabs/scriptable objects when the application quits. Is there a way I can autosave every few minutes or so (and this is advisable)?
I am thinking I can do something like this (pseudocode):

Code: Select all

if (FiveMinutesHavePassed) {
	ES3AutoSaveMgr.Current.Save();
}
Also right now, I am explicitly saving all of my prefabs and scriptable objects like this:

Code: Select all

ES3.Save("bug", gameObject);
But should I be using the codeless auto save to handle this (seems like this only works with prefabs, not with scriptable objects) if I want to save periodically? Or is there a way I can gracefully handle autosaving all of my keys via code?
Thanks,
Sarah

Re: Auto Save every 5 minutes

Posted: Fri Nov 12, 2021 10:35 pm
by Joel
Hi Sarah,

If you wanted to save at certain intervals you could put the ES3AutoSaveMgr.Current.Save() in a coroutine with WaitForSeconds. As this is part of Unity's functionality, I recommend looking at their docs:
https://docs.unity3d.com/ScriptReferenc ... conds.html

Regarding Auto Save vs code, Auto Save is only designed to save GameObjects and their components. For more information please see the Auto Save guide:
https://docs.moodkie.com/easy-save-3/es ... hout-code/

All the best,
Joel

Re: Auto Save every 5 minutes

Posted: Fri Nov 12, 2021 10:37 pm
by syu15
Thanks for the quick reply Joel, yeah I was suspecting this was something I would have to code myself, so no problem.
However, is there a way to autosave all of my gameobjects and scriptable objects at once? Or do I have to explicitly save out every key/value at the interval?

Re: Auto Save every 5 minutes

Posted: Sat Nov 13, 2021 1:05 am
by Joel
Hi Sarah,

With Auto Save you need to select every GameObject/Component that you want to save. With code you can put all of your GameObjects in an array or List and save/load that.

All the best,
Joel

Re: Auto Save every 5 minutes

Posted: Sat Nov 13, 2021 6:15 am
by syu15
I see. Ok thanks!