This quick post documents how I typically set up a Unity project when working with external version control. Though it focuses on using Git or Mercurial via SourceTree, the principles can be applied to other version control tools.
- Using SourceTree (or github.com, bitbucket.org, etc.), create your remote repository and clone it to a local directory
- Open Unity and create a new project inside your local repository directory
In Unity, go to
Editorand configure the following:
Version Control, set
Visible Meta Files
Asset Serialization, set
Unity really only needs the
ProjectSettingsfolders found in your project directory. All other files and folders –
Tempfor instance – can be generated. Therefore, in SourceTree you can go to
Advancedand edit your ignore file to contain the following, adjusting as needed:
# =============== # # Unity generated # # =============== # Temp/ Library/ # ===================================== # # Visual Studio / MonoDevelop generated # # ===================================== # ExportedObj/ obj/ *.svd *.userprefs *.csproj *.pidb *.suo *.sln *.user *.unityproj *.booproj # ============ # # OS generated # # ============ # .DS_Store .DS_Store? ._* .Spotlight-V100 .Trashes ehthumbs.db Thumbs.db
This should be enough to get you started using Unity with external version control. You can test out your configuration by pushing your configured project to your repository and re-cloning into a new directory. If the project opens correctly from there, you’re likely in good shape!