The other day, one of my co-workers lost about one day of work because Unity crashed. Even if Unity is more stable nowadays, the fact that there is no auto-save in Unity is always painful, as you’re left with empty prefabs and stuff to do again.
I’m aware a solution is provided on the wiki, but it’s not very practical as you need to keep an editor window open all the time, and remember to open it. So I made a couple scripts to have your work saved automatically, without anything to do except put the files in an editor folder somewhere.
Features :
Choose when to save : every X seconds, on entering play, on building, ar any combinaison of these.
Optional incremental save.
Save as copy or override the file
Optionally save the project as well, that way your prefabs are also saved.
Support for template name for saving : i.e. MyScene.unity can be saved as MyScene_backUp.unity, or whatever you like.
Settings for Auto save are under Edit>Preferences, just like it was an integral part of Unity.
Several save slots for specified settings if you need it
Currently everything works, I think I can get a better layout for the Settings page, but currently I’m focusing on cleaning the code and smoothing it out to put it on the asset store.
Do you have any idea of feature or option you’d like to have with that? I’m testing something to have optionally a prompt before saving, as for some heavy scene you might want to wait sometimes before saving if you’re in the middle of something.
Are the settings for this saved per-project? If so, that would be great.
Rather than a prompt, I would recommend having an option to wait for an idle period for the “Save on Time” option. You can just monitor mouse moves and keyboard events.
For now, the settings are saved via EditorPrefs, so it’s actually per-seat. I’ll look into it, there must be a way to get the projects name via script.
Saving when afk could be a nice idea indeed, and as you said rather easy to implement.
You could use the project path as the key for the EditorPrefs for some xml document storing these settings. That would sort of make it on a per project basis (you could have two projects lying around with the same contents though, but I dont see how to solve this issue since we dont have an unity project solutions file).
It’s what I think I’ll end up doing, but I want to see first if the api doesn’t provide a cleaner way to identify a project. This would work but would break if the project folder is moved or renamed. Anyway, it’s not really a big deal as nothing critical is saved, just slightly annoying.
You could also have a single text file in the project which stores a unique key for the project. that way you can have multiple copies of the same project with the same EditorPref settings.
If there isnt a text file in the project it could prompt the user for a key or autogenerate it.
Hadn’t thought about that. I like this idea, which could easily enable per-project or global settings, as well as copy settings from one project to another.
Thanks!
also, you could add this in (if you’re not already working on it) : it saves the scene. like remembers where the player was and what current scene. For those people with multiple scenes!