Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
7
Question by Mathias · Aug 20, 2011 at 07:36 AM · saveauto

Auto save every five minutes?

Hi.

Most of us know the 3.4 ver. of Unity is slightly less stable than it really should but, for us/me there is nothing we/I can do about it. So I was thinking about the next best; an auto save function within Unity.

Since yesterday evening I was on a roll and had really fun creating my game but, as stupid as I am(I blame no other than myself) I had forgotten to save for hours, and of course the inevitable happens. Unity crashes and I almost burst into tears.

So after a night of banging my head against the wall I ask you. Is it possible to have a auto save function inside Unity so it saves every 5 minutes or so? Can that be done by scripts or...?

Thank you for your time.

Comment
Add comment · Show 6
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 FLASHDENMARK · Aug 20, 2011 at 07:40 AM 0
Share

Is it disrespectful to say that I laughed a little? But I did "Banging my head against the wall". No disrespect though. I am sorry for your loss of work.

But 3.4 is less stable and Unity could benefit from an auto save function. And it will properly save my butt sooner or later. I do not know if one exists already, though.

It could be cool if you could access the save function from script.

avatar image Mathias · Aug 20, 2011 at 08:01 AM 0
Share

@OrangeLightning No, you did not offend me or any of that jazz. :) There is nothing I can do about it so there is really no reason to be mad. But it dose slightly annoy me.

avatar image Joshua · Aug 20, 2011 at 08:18 AM 0
Share

Good news: we can expect a more stable version, 3.4.1, to come out in the co$$anonymous$$g week. :)

avatar image Mathias · Aug 20, 2011 at 09:57 AM 0
Share

@Joshua Who told you that. Source? :)

avatar image Joshua · Aug 23, 2011 at 07:46 AM 0
Share

@$$anonymous$$athias in between my spam$$anonymous$$g of bug reports for all the different issues in 3.4 I asked them if/when they expected a version more stable on Windows to be released. They told me 'probably' in the week that is now this week.

Show more comments

3 Replies

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

Answer by YikYikHeiHei · Aug 20, 2011 at 08:04 AM

OBSOLETE:

Please see that

http://www.unifycommunity.com/wiki/index.php?title=AutoSave

EDIT:

https://gist.github.com/dustingraham/3e5367a12acba1eb013cc35e187e3898

  using UnityEngine;
  using UnityEditor;
  
  [InitializeOnLoad]
  public class AutosaveOnRun
  {
      static AutosaveOnRun()
      {
          EditorApplication.playmodeStateChanged = () =>
          {
              if(EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying)
              {
                  Debug.Log("Auto-Saving scene before entering Play mode: " + EditorApplication.currentScene);
                  
                  EditorApplication.SaveScene();
                  EditorApplication.SaveAssets();
              }
          };
      }
  }
Comment
Add comment · Show 3 · 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 Miggl · Sep 02, 2013 at 02:46 PM 0
Share

This is not working for me in Unity 4.2. It causes Unity to crash every time I try to run the script (via Window > Autosave).

avatar image Huacanacha · May 02, 2014 at 04:50 PM 1
Share

For autosave on Play functionality add this script to ad "Editor" folder:

 using UnityEngine;
 using UnityEditor;
 
 [InitializeOnLoad]
 public class AutosaveOnRun
 {
     static AutosaveOnRun()
     {
         EditorApplication.playmodeStateChanged = () =>
         {
             if(EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying)
             {
                 Debug.Log("Auto-Saving scene before entering Play mode: " + EditorApplication.currentScene);
                 
                 EditorApplication.SaveScene();
                 EditorApplication.SaveAssets();
             }
         };
     }
 }

Via: http://www.daikonforge.com/dfgui/save-on-run/

avatar image sarynth · Mar 26, 2018 at 05:41 AM 0
Share

Unity 2017.4 says that is deprecated, here is an updated version that works for me: https://gist.github.com/dustingraham/3e5367a12acba1eb013cc35e187e3898 note it saves all open scenes.

avatar image
4

Answer by Eric5h5 · Aug 20, 2011 at 08:05 AM

Unity auto-saves whenever you hit play. If it crashes, retrieve the __EditModeScene from the Temp folder (before you load Unity again) and rename it to whatever your scene file is called.

Comment
Add comment · Show 3 · 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 Stone-Legion · Nov 25, 2013 at 12:58 PM 0
Share

Unity 4.3 doesnt autosave when you hit play, I just lost 2 hours of work due to crash. Wish I had have known this little tid-bit of info before I reopened Unity again right after. I thought by 4.3 autosave would be a standard feature, I guess not.

avatar image Huacanacha · May 02, 2014 at 04:49 PM 2
Share

Unity doesn't autosave your own scene file on play but it does save a copy... unfortunately it nukes this temporary copy when you start Unity again.

For a real autosave on play that saves your permanent scene file, add this script to an "Editor" folder:

 using UnityEngine;
 using UnityEditor;
 
 [InitializeOnLoad]
 public class AutosaveOnRun
 {
     static AutosaveOnRun()
     {
         EditorApplication.playmodeStateChanged = () =>
         {
             if(EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying)
             {
                 Debug.Log("Auto-Saving scene before entering Play mode: " + EditorApplication.currentScene);
                 
                 EditorApplication.SaveScene();
                 EditorApplication.SaveAssets();
             }
         };
     }
 }

Via: http://www.daikonforge.com/dfgui/save-on-run/

avatar image Kamuiyshirou · May 02, 2014 at 05:10 PM 0
Share

On Android???

avatar image
1

Answer by xortrox · May 02, 2014 at 04:53 PM

Just remember to use Ctrl+S?

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

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

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

input .lzma too short 0 Answers

PlayerPrefs not working? 1 Answer

IsolatedStorageException: Could not find a part of the path 1 Answer

Port Project Setting TO Another Project 0 Answers

Questions about XML save/load 0 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