- Home /
Unity double save/back-up
Hello, I would like to know if there is a way to double save the project when you hit file > save scene. I have never created an editor script before but i think I should do it this way : EditorApplication.SaveScene
. I would like to save the scene in the normal folder and also in a extern hard drive. Something like this :
File > Save Scene => save the scene in:
C:\Unity projects\Puzzle
E:\Unity projects\Puzzle, this is my extern hard drive.
Could anyone help me out? Thanks in advance
Answer by Julien-Lynge · Dec 27, 2011 at 07:45 PM
The issue, of course, is listening for the save event when the user goes to File > Save Scene. As far as I'm aware there's no way to register a listener for this event, so you have a few options:
Create your own menu button for double saving that saves a copy to http://unity3d.com/support/documentation/ScriptReference/EditorApplication-currentScene.html and a copy to somewhere you specify (or you can try calling http://unity3d.com/support/documentation/ScriptReference/EditorApplication.ExecuteMenuItem.html)
Use the editor update function to check for changes to the scene file and save out a copy when it changes (which I don't recommend)
Look for other events and perform a save when you see them. E.g., look for isCompiling or isPlayingOrWillChangePlaymode and save then.
If have one more problem, how the do I define the location where the scene is saved? I tried this : EditorApplication.SaveScene("E:\Unity projects\Puzzle\Assets\Scenes"); but it didn't work..
Your answer
Follow this Question
Related Questions
Bind to OnWillSaveAssets and force to save my scene 0 Answers
unexpected char: 'U'. when File.WriteAllBytes() 2 Answers
Real Time Multi-Developer Level Editing 0 Answers
save scene to separate multiple scene files 1 Answer
Detect when project is saved 1 Answer