informa
6 MIN READ
Featured Blog

How to set up a third-party version control in Unity.

Doing games on your own is alot of fun at first. But when you need to add more people to the team, having multiple versions of the game on each computer can be annoying. And this is where version control comes to save the day.

The problem.

When working on a team project, via web or physically, a problem arises after some time working on it, everyone holds a modified copy of the project, and mailing or passing the usb for every single change can be pretty annoying. That's why version control was invented. 

First of all I want to clarify 2 things regarding version control:

1. I am in no means an expert, so this might not be the best approach there is.

2. I'm mainly writing this post because the resources available online where scarce or really hard to find for me (Damn you, google). So it might help anyone not that familiar with version control, or version control in Unity, at least.

3. Again, this is focused on version control for unity, but I'm quite sure it works for other things.

4. I don't know how to count.

On a serious fact tho, if you are inexperienced in the matter as I was (ok ok, as I am), you might be wondering, What the heck is version control? You can find alot of definitions for it online, but to put things simple: Version control is when you have a project, modify it, but instead of replacing the whole project, the version control system creates a new version while keeping the original, only by saving the changes, instead of a whole new copy (That could take a lot of space). Why is that awesome? because it allows people to download a copy of the main project, completely destroy it (you know, science) and keep the project intact. It also allows to go back to the previous changes on the main project if something went terribly wrong, or you just don't like the new blue in your shader.

My first attempt at version control was with git, and it went horrible. Maybe I was not ready, but errors arised every 10 seconds, code got all mixed and I had no clue on what I was supposed to do. Now imagine explaining how to use it to the rest of the team. And t+hen we just decided to go rogue for a while with no version control, what a mistake. But we honestly though that besides pro licensed unity version control, there where no free choices available that could integrate to unity properly, another mistake (Yeah, spare me the lecture).

So without any further weeping story, here is what I did, the same thing can work for a new project as for an old one (Although you might want to keep a backup copy of your project, in case I'm some project destroyer lunatic).

Instructions

First, open Unity, and go to Edit -> Project Settings -> Editor and change the Version Control Mode to Visible Meta Files.

After that, close Unity, then go to your game folder (In my case its Documents\GameName) and Delete the library folder (Don't worry, unity creates it again when you open the project).

Now, create an svn host (A what?), well, basically its the server where your project will go to. I personally created an account on cloudforge.com and will explain the steps to it, but you can find alot of hosting services online, I just went for cloudforge because it was the first thing that popped on google (Note to self: Honesty can make you look really lazy).

After creating a 30-day trial account (After that it costs like 2$ a month), enter your dashboard and create a new project. Add subversion to your project (I just ticked everything because they looked cool, also for the teamforge personal wiki but that's another story).

Now just copy your svn url and that's pretty much it for cloudforge setup. If you used other svn host the steps should be the same as long as you get the svn url.

After that, you need a svn manager, and as with hosting, there are many options for this. In my case I went for TortoiseSVN (http://tortoisesvn.net/downloads.html) because it has graphical interface, and it's easy to use.

After installing it, you're done! Nah, just kidding, but there's very few things to be done.

Now, right click on your project folder and select TortoiseSVN -> Import... A popup will appear, in url paste your svn url from your host. It will ask you for a user and password, which are the same ones for your account. After doing this, the files will be uploaded and your project will be now on the cloud, you can delete your project now for disk sake, but to avoid an error and getting someone at my house yelling at me, you might want to keep it there.

After doing this, create a new folder, this is where all the project will go to. right click it and choose SVN checkout, another popup will appear, make sure that you select your new folder on checkout directory and paste your svn url in the URL of repository part. After doing this, your project will be downloaded into the folder, and you can begin working with it (Remember to open the project with the open other option).

That's pretty much it, but let's do something else before we start destroying everything. Open Unity again, create a new asset (like a file or something). Now close it (Or keep it open, doesn't matter that much). Now right click your project folder and select SVN Commit, after that you will be prompted to select what items you want to commit, you might notice that the library folder and all the files in there are up (I told you it was going to come back (; ), right click the library folder, and select add to ignore list -> Library (Recursively), that way our library folder will not go to the server, you might want to do this process for other files later. Now be sure that the files you want to upload (In this case the new asset you created) are checked, add a message for that commit and hit ok. If everything went right your folder is now updated.

Now you have your version control system up and running but you might want to add some people to it, right? Now while I'm sure there's console commands for adding users in your svn space, I'll go for the cloudforge instructions. Go to your project page and click on users on the left side menu. After that click on add users and create an account for your new user. After that the new user should install Tortoise or whatever you are using, and do the create folder and svn checkout parts. 

And that's it. Any changes anyone commits to the project will be synched to the server. Now to sync your project just right click your folder and select SVN Update.

Again, I'm no expert in the subject but I hope this helps someone or puts him on track on what to do to keep yourself and your team sane enough when managing it. Cheers.

Sources:

Unity Manual: Using External Version Control Systems with Unity http://docs.unity3d.com/Manual/ExternalVersionControlSystemSupport.html

SVN Source Control Setup for final project http://web.cs.wpi.edu/~rich/courses/imgd4000-d12/svn.html

Latest Jobs

Manticore Games

San Mateo, California
8.23.22
Senior Software Engineer - Mobile

Sony PlayStation

San Diego, California
6.23.22
Sr. Online Programmer

The Walt Disney Company

Glendale, California
8.1.22
Associate Marketing Manager - Walt Disney Games

Insomniac Games

Burbank, California
8.26.22
Accessibility Design Researcher
More Jobs   

CONNECT WITH US

Explore the
Subscribe to
Follow us

Game Developer Job Board

Game Developer Newsletter

@gamedevdotcom

Explore the

Game Developer Job Board

Browse open positions across the game industry or recruit new talent for your studio

Browse
Subscribe to

Game Developer Newsletter

Get daily Game Developer top stories every morning straight into your inbox

Subscribe
Follow us

@gamedevdotcom

Follow us @gamedevdotcom to stay up-to-date with the latest news & insider information about events & more