Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
5
Question by jimbobuk · Dec 16, 2009 at 02:40 AM · editoreditor-scripting

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

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

4 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Stelimar · Dec 16, 2009 at 03:16 AM

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
4

Answer by Waz · Feb 16, 2011 at 01:35 AM

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...").

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Waz · Jul 30, 2011 at 02:48 AM 0
Share

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

avatar image
1

Answer by smokris · Mar 31, 2011 at 06:47 PM

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

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Cymrix · Sep 21, 2011 at 01:13 AM 0
Share

This seems to work. Nice find! Thank you!

avatar image
0

Answer by whydoidoit · Jul 15, 2012 at 05:39 PM

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");
  }
  
  
  
 
 }
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image whydoidoit · Jul 15, 2012 at 05:40 PM 1
Share

Since UDN this code editor absolutely sucks.

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

How can I simulate the "f" hotkey in the editor? 4 Answers

AssetPostprocessor: How to persist changes to a model 1 Answer

breaking out of OnGUI() ticks? 1 Answer

How can I see script dependencies? 8 Answers

Unity API for checking if an object was modified 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges