Friday 6 December 2013

Unity 3D SVN Setup and Usage

I have just started to create projects for Unity 3D to try things out.

I use Subversion (SVN) for my code storage and wanted to do the same with my Unity projects.  Luckily I had been doing lots of reading so had already come across the fact that unlike code based projects Unity needs a few changes to support using SVN.

The changes are very minor but important.  These include some useful reminders detailing what to do:
http://docs.unity3d.com/Documentation/Manual/ExternalVersionControlSystemSupport.html
http://blog.teamthinklabs.com/index.php/2012/04/11/unity-3-5-and-svn-now-easy-and-free-for-all/

Most of the guides mention using Meta-files.  Version 4 of Unity has two settings, hidden meta files or visible meta files.  I took them to mean use 'Visible' Meta Files' for SVN.

Edit -> Project Settings -> Editor...  Mode = Visible Meta Files

There are also Unity add-ins for helping with this but having everything in one intergated development environment (IDE) is not something I have ever worried about so I did not look in to any of those add-ins.

I use TortoiseSVN, and to make things easier I use the Ignore list to stop the Library folder showing up as missing.  That folder does not need to be stored with the source code because it is a local cache and will be rebuilt as needed.



Do not select the 'Library(recursive)' option because you may want to use the name 'Library' elsewhere in your repository.

 

I use the 'Check for Modifications' feature to make sure I commit any changes I make within the project:


When using SVN with Unity do NOT rename folders either in Unity nor with SVN.  Renaming in either case messes up the other

The simple solution is to always create a new folder in Unity and move the assets from the old folder to the new folder within Unity.  You can then delete the empty folder in Unity.  Add the new folder from your SVN client and commit the project.

 


You can delete or move assets within Unity it is just renaming folders that has a problem because the meta-data for either SVN or Unity is not updated by the other.

Although it it not tidy, missing folders and files can be marked as deleted when you commit your changes to the SVN repository.

Any missing items must be marked to be included in the commit before you do an Update.  If you do an SVN update before marking the missing items then those items will be restored from the repository.


Tortoise SVN has a convenient link to mark all missing items as deleted.

There are other ways to do the same things and here is another article on the same subject.


No comments: