Unity projects need to be backed up.
There’s a lot of options and lot’s of questions to ask yourself.
The big question is…could you recreate your project from scratch if something happened to it?
Does your Design or Build documentation cover off every tweak and setting of all your scenes, objects, and prefabs?
What about using a Unity Plug In?
Or Custom Scripts?
Also what do you neeed to Backup?
If you’re using Source Control like SVN or GIT what do you exclude in your exclude file?
What does Unity say?
What about Unity users in the forums what is their advice?
Let’s start with some options for backing up Unity Projects.
I’ll list the one’s I’ve looked at here:
1. Manual backup of your Unity Project Folder
– That’s right. Just copy the whole root project folder somewhere else.
It’s quick and dirty but reliable. Even better if you copy to another location off your workstation.
2. Your project can be placed under source control.
– The Unity Manual says that Unity supports version control integration with Perforce and Plastic SCM.
– I’ve tried Perforce and it was a little difficult to set up and I can’t say I really got some of the key concepts behind the product but it looks like standard source control and seems to work.
– I didn’t try Plastic SCM as it didn’t seem as well integrated or supported
– GIT is an easier beast to work with I found.
– Unity have advice on using external source control software like SVN for your project files and code.
3. You can use the Unity Editor to work in the Cloud
– There is a button called Collaborate! Just click it.
When you open up your Projects page in Unity you can see the one’s in Cloud storage here:
The features of the Cloud storage are here: https://unity3d.com/unity/features/collaborate
You don’t get much for a free account – but it’s not that expensive and if you have a good internet connection it’s very reliable.
4. In the Asset Store there is (or at least used to be) a Unity Asset Repository product.
– It seems to be discontinued so I won’t dwell on that.
I’ve never used any of these so I won’t comment on that either. There are plenty of reviews on the Asset Store so I guess if you’re interested you can read them.
6. If you want automatic regular backups on a Mac you could use Time Machine.
On a Windows box you could also schedule backups with File History and/or Windows Backup and Restore.
Another alternative that works on anything is DropBox.
7. Finally – there are of course dedicated Backup Solutions ( think NetBackup ) out there – maybe you are already using one.
What to Backup?
So the next question is what in your Unity Project Folder do you need to back up?
The short answer is the Assets and Project Settings only.
The Library, Temp, Obj, .SLNs and .Proj will be regenerated.
But the long answer has a few other folders that you might have created for your project.
The base folders that all projects get when initiated are: Assets, Library, & Project Settings.
Assets is where the majority of your work will go but you could also use any number of other special folders like:
Editor Default Resources
There is also a Temp folder which sometimes has it’s uses to keep a copy of.
(See my blog post on recovering a corrupted scene – DO NOT RESTART UNITY before taking a backup!)
So what folders need to be backed up?
Assets definitely – but everything in there? What about .meta files.
Meta files are created for every asset and are visible in the explorer of your operating system but not by default visible in the Unity Editor.
The Meta file has a reference to the Unity ID code assigned to the object. If you lose your meta file you lose all the references to your objects in the editor and have to relink everything.
The Library folder is analagous to the Unity cache. It’s a dynamically loaded set of data that Unity creates for your project. Each asset in your Asset’s folder is converted into a Unit Readable data format in this folder so that it can be dynamically played with in the editor. Normally as a user you would not need to do anything with the contents of this folder and it’s not necessary to back it up as it’s able to be regenerated every time Unity starts up your project.
The Unity Manual says:
When backing up a project, or adding a project to a Version Control Repository, you should include the main Unity project folder, containing both the Assets and ProjectSettings folders. All the information in these folders is crucial to the way Unity works. You should omit the Library and Temp folders for backup purposes.
I guess one of the bottom lines of this post is: Use Version Control.
But are version control and back ups two different things? I say yes.
Version Control is a point in time file based recovery of your work but Backups are a whole system recovery for when things really go boom! Like when your laptop gets dropped off the balcony.
So if you are using Version Control you also need to use an ignore file so you don’t have to backup stuff that you don’t need to back up.
There are some really awesome flame wars in all sorts of forums arguing for and against .gitignore files. This reddit link is really funny if you like reading passionate people and idiots talking to each other on the internet.
A .gitignore file tells Git which files/folders should not be in the repository. It is usually used to avoid committing transient files or files that can be reproduced (like those in the Library folder).
When you create a new repository on GitHub. There is a dropdown that lets you choose a .gitignore file and they just happen to have a Unity one available. Just grab a copy of it and stick it in the main folder of your Unity project.
I commit to the repository every time I have made a big change. This lets me revert to any previous commit if necessary. The downside is that unless you feel like paying, your repository will need to be public, meaning anyone can see your project.
If you don’t want to use the terminal, you can also download Github desktop which gives you a simple and clear interface to handle your repositories.
The GitHub.app is the easiest way to work with Git. It is simple to create a repository by draging your Unity folder into the GitHub.app and add your .gitignore file. It only takes seconds and will save your butt.
Before checking your project in, you have to tell Unity to modify the project structure slightly to make it compatible with storing assets in an external version control system. This is done by selecting Edit->Project Settings->Editor in the application menu and enabling External Version Control support by selecting Visible Meta Files in the dropdown for Version Contr
I’ve read from various forums that people have been backing up by creating an empty game object and parenting all other objects under it. Then they will create a prefab out of this and export the object and scenes at the same time. It kind of makes sense for an easy restore of your objects as all you have to do is import that prefab into a project to do a restore.
Obviously this is no good if you got lots (like thousands) of objects and assets. You will lose things like layer names, tags, and other Project settings. Plus you might as well just copy the Project folder. Exporting packages is useful thing, but it’s not a substitute for a proper backup.
When you do backup make sure you get all the metafiles. The files are used to keep track of everything in the project and their locations. They are hidden by default, but can be made visible by going into Edit | Project Settings | Editor Settings | switch Version Control Mode to Visible Meta Files.
That’s about it for backups – I guess the bottom line is – if you are not backing up…