Auto Save every 5 minutes

Discussion and help for Easy Save 3
Post Reply
syu15
Posts: 16
Joined: Thu May 13, 2021 1:05 am

Auto Save every 5 minutes

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

Re: Auto Save every 5 minutes

Post 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
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
syu15
Posts: 16
Joined: Thu May 13, 2021 1:05 am

Re: Auto Save every 5 minutes

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

Re: Auto Save every 5 minutes

Post 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
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
syu15
Posts: 16
Joined: Thu May 13, 2021 1:05 am

Re: Auto Save every 5 minutes

Post by syu15 »

I see. Ok thanks!
Post Reply