Posts Tagged CVS
Remember when CVS was a pretty neat version control system for one guy working out of his garage? Then many of us became enamored with SVN, which was a nice upgrade offering many additional options than your standard CVS. There are many other version control software packages on the market as well, some cost money and others are free. When it comes to the Unity3D Pro game engine there really are two version control systems that come to mind.
- Unity3D Asset Server – Costs $500.00 (as of June 4, 2011). It’s an add-on component that requires additional hardware resources to run on. It doesn’t appear that you can run this thing in the cloud (i.e. Amazon ec2, or pick your favorite virtual flavor).
- SVN – FREE, but a real pain to setup with your Unity3D project. What folders and data do you not upload into your repository? Unity has a how-to, but it still stinks when you have those .svn folders peppered throughout your project.
As of June 4, 2011 Unity3D Pro shares these two options on their website (including the HOW-TO). http://unity3d.com/support/documentation/Manual/ExternalVersionControlSystemSupport.html
What if there was one more option that wasn’t discussed by Unity3D? What if this option was as easy as SVN, if not easier to implement?
Enter in Git. I have personally setup my Unity3D projects using SVN in the past and after using Git, I can’t stress how great this product is for your Unity3D projects. No more nasty .svn folders incidentally getting distributed in your software or irritatingly peppered throughout. Also, branches, tags and the ominous merges are handled inherently much better in Git. As a side note, Git was created for one of the most popular open source projects on the planet earth… Linux. And it was started by the king of handling merges… Linus Torvalds himself. Not that that should steer your thinking much, but I have to admit I was slow to begin using Git. Now that I’m using Git, I’ve already converted all my latest projects over to it because I just can’t seem to live without it’s simplicity and power.
So how do I integrate Git? I’m not going to go into detail on setting up your own Git repository here. You can easily set one up over at github.com. Or for the more adventurous, you can create your own Git repository and integrate a authentication/permissions or use straight SSH. BTW, I recommend to use gitolite for authentication/permissions. Gitolite, will make integration a snap without forcing you to create a handful of accounts on your Linux server. It also doesn’t hurt that Fedora and a few other big systems use and support Gitolite.
You still have to follow some of the Unity3D directions for creating an SVN friendly Unity3D project. More specifically, you need to follow the first 3 directions they list. Well here is my recipe…
Please note, this only applies to Unity Pro Licenses.
- Create a new project inside Unity and lets call it InitialUnityProject. You can add any initial assets here or add them later on.
- Enable Meta files in Edit->Project Settings->Editor
- Quit Unity (We do this to assure that all the files are saved).
- (My addition) Create a new Git repository for your project. Setup git on your local workstation and pull the empty repository down to a folder
- (My addition) Copy your new Unity3D project over to that local repository project folder.
- (My addition) Create a .gitignore using my recipe or a modification as shown below.
- (My addition) Startup Unity3D and open the project from the new local repository project folder.
See below for a .gitignore file which is stored at the root of your local repository location. It will take care of helping you avoid storing the wrong files into your Git repository!
# Unity3D .gitignore file. # Store this file at the root of your local repository. .DS_Store Library/AssetImportState Library/AssetServerCacheV3 Library/FailedAssetImports.txt Library/ScriptAssemblies Library/ScriptMapper Library/assetDatabase3 Library/cache Library/expandedItems Library/metadata Library/previews Library/guidmapper Temp *.pidb build
Remember with Git, that you are operating on your local repository until you perform the git push origin master. This means you can bundle your commits into the parent version control!
Finally, I feel like I discovered a happy medium of finding a free alternative that works better than SVN with the Unity3D game environment.
Good luck with your projects and happy game developing!