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:
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.