Cape Guy

  • Games
    • Re-Entry
    • Ski Three
    • 80 Days on PC and Mac
  • Blog
  • About
    • About
    • Friends
  • Contact

Unity Auto-Save on Play in Editor

9 July 2015 By Ben

Years of experience (specifically a few bad experiences) have taught me to save my work as often as possible. Because of this I have a tendency to save my Unity project and scene pretty much every time I enter play mode to test something. After a while I thought I’d try and automate this process so I wrote an editor script to do it for me.

It always overwrites the same save files so it’s not a proper versioned auto-save feature (ie. there’s no way to roll back to before the last time you entered play mode). As I use Git I can stage changes at points that I want to be able to return to so it isn’t really an issue for me but it’s something you need to be aware of if you decide to give the script a go. Otherwise it’s possible that you may actually lose work due to unexpected save overwriting :-/.

So here’s the code, please let me know if you discover any issues with it or have any suggestions of ways it can be improved…

Here’s the code:

SaveAllOnEnterPlayMode.cs

Note: It needs to be inside an Editor folder in your project to work. It does not need adding to a game object or anything else, just to be in the project.

Filed Under: Games Development, Programming, Unity

  • E-mail
  • Facebook
  • LinkedIn
  • Twitter

Latest Tweets

  • Just finished ironing out a few glitches in #ReEntry's space-time continuum #IndieDev #gamedev https://t.co/jhT2CWPSQd 26 February 2019 10:31 pm
  • #SkiThree version 2.0 is out! Loads of improvements, and it's now Pay Once and Play! https://t.co/LiPMP4QtkI #madewithunity #unityawards 30 September 2018 10:41 am
  • I’ve been blogging about disabling @unity3d editor's Assembly Reload feature while in play mode again:… https://t.co/GmdgVVtH8h 12 June 2018 11:44 am

Copyright © 2025 Cape Guy Ltd.