x


Are there any autosave scripts out there to protect against losing too much work?

Generally unity is a stable program, but i do experience some problems from time to time. As discussed in another answer, an infinite loop is a particularly tricky one that you can't recover from and will take the editor down, understandably.

Anyways i wondered if there was the possibility or if such an editor script existed already that would autosave unity every so often. I wouldn't object to it doing something visible like a countdown to when you can expect a pause to happen. Some intelligence would be good if it could wait till you aren't holding down a mouse button doing anything to objects or properties.

Ideally it could autosave out to separate files than normal but i don't know how feasible this is, its not like the unity scene/project is stored in just a few files, or are they? If this is not possible just saving with the defaults would still be better than nothing.

Cheers

more ▼

asked Dec 16 '09 at 02:40 AM

jimbobuk gravatar image

jimbobuk
1.1k 34 42 54

(comments are locked)
10|3000 characters needed characters left

4 answers: sort voted first

I don't know of any existing scripts, but you could easily create your own. Take a look at the EditorApplication class. Particularly, the SaveScene, SaveCurrentSceneIfUserWantsTo and SaveAssets functions, as well as the currentScene property.

more ▼

answered Dec 16 '09 at 03:16 AM

Stelimar gravatar image

Stelimar
3k 14 16 50

(comments are locked)
10|3000 characters needed characters left

Eric5h5 reported on the forums:

Unity already has auto-save...any time you enter play mode, the current scene is backed up in the temp folder as "__EditModeScene". This can be moved and renamed if necessary, and used like any other ".unity" scene file.

Hopefully the next person to suffer reads this Answer before restarting Unity and pressing Play again. And maybe one day Unity will pay attention to that file on restart ("Unity crashed, and in addition to sending in a bug report, here's all your work back...").

more ▼

answered Feb 16 '11 at 01:35 AM

Waz gravatar image

Waz
6.5k 22 33 71

Note that this doesn't save assets, so it's only half a solution.

Jul 30 '11 at 02:48 AM Waz
(comments are locked)
10|3000 characters needed characters left

There's an AutoSave Script on the Unify Community Wiki.

more ▼

answered Mar 31 '11 at 06:47 PM

smokris gravatar image

smokris
366 5 6 14

This seems to work. Nice find! Thank you!

Sep 21 '11 at 01:13 AM Cymrix
(comments are locked)
10|3000 characters needed characters left

Given the amount of trouble I seem to have when running the game with the project and the scene being lost if it crashes (which is frequent for me when attaching the debugger) I have written an auto save on run - rather than on a frequency:

using UnityEngine;
using UnityEditor;
using System.Collections;


[ExecuteInEditMode]
public class AutoSave : EditorWindow
{
 [MenuItem("AutoSave/Enabled")]
 static void AutoSaveEnable()
 {
 EditorWindow.GetWindow<AutoSave>();
 }

 static void StateChanged ()
 {
 if(Application.isPlaying == false)
 {
 Debug.Log("SAVED SCENE AND PROJECT");
 EditorApplication.SaveScene();
 EditorApplication.SaveAssets();
 }
 }


 static AutoSave()
 {
 EditorApplication.playmodeStateChanged += StateChanged;
 }

 void OnGUI()
 {
 GUILayout.Label("Autosave Enabled");
 }




}
more ▼

answered Jul 15 '12 at 05:39 PM

whydoidoit gravatar image

whydoidoit
33.1k 12 23 101

Since UDN this code editor absolutely sucks.

Jul 15 '12 at 05:40 PM whydoidoit
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5099
x1679
x349

asked: Dec 16 '09 at 02:40 AM

Seen: 1979 times

Last Updated: Jul 15 '12 at 05:40 PM