31
\$\begingroup\$

I have a Unity project without any version control, and I need to share it with another developer so that both of us can work on the project.

What strategies should be use that play nice with Unity Assets?

\$\endgroup\$
3
  • \$\begingroup\$ I think this article will give you some tips: va.lent.in/blog/2011/12/13/… \$\endgroup\$
    – Den
    Commented Dec 16, 2011 at 18:37
  • 2
    \$\begingroup\$ DropBox supports version control, the feature is called "Pack-Rat" but its not free. For advice for beginner indie developers, numerous questions have been asked before. I would suggest you to walk around a little. Finally Welcome to GameDev SE! \$\endgroup\$ Commented Dec 16, 2011 at 18:43
  • \$\begingroup\$ Without the asset server there might be some issues when moving back and forth prefabs and scenes \$\endgroup\$
    – Sidar
    Commented Jul 9, 2013 at 21:30

7 Answers 7

18
\$\begingroup\$

Unity has a built in facility for supporting version control properly.

Just go into the File->Project Settings->Editor and enable external version control.

\$\endgroup\$
4
  • 4
    \$\begingroup\$ Is this a Pro-only feature? I don't see that menu item in the free/indie Windows version of Unity 2.6. \$\endgroup\$
    – James
    Commented Aug 13, 2010 at 17:13
  • \$\begingroup\$ As of 1/30/2011, it is Pro-only. See the 2nd paragraph of: unity3d.com/support/documentation/Manual/… \$\endgroup\$
    – ojrac
    Commented Jan 31, 2011 at 1:07
  • 11
    \$\begingroup\$ The latest developer preview of Unity (3.5 RC1) has made a change to support version control in the free version. from the changelog (unity3d.com/unity/preview/notes): License: Generic external version control (.meta files) are now available in the free version. \$\endgroup\$ Commented Jan 27, 2012 at 19:01
  • 2
    \$\begingroup\$ just fyi for future visitors, note the date on this answer; it is way out of date by now. Now there's no need to turn on any setting; just version the folders "Assets" (make sure your version control is picking up hidden .meta files) and "Project Settings" and ignore everything else. \$\endgroup\$
    – jhocking
    Commented Jun 27, 2014 at 12:48
11
\$\begingroup\$

I recommend using Git, it's free and the best around.

A while ago I wrote about version control (using Git) on my blog

Long story short:

Enable external version control File->Project Settings->Editor and create the .gitignore file in order to avoid unnecessary stuff on the repo (this is not really necessary, but it will be priceless during development).

Here's how the file should look like:

[Oo]bj/
[Tt]emp/
[Ll]ibrary

#These are files in the root folder of the project
*.tmproj
*.csproj
*.unityproj
*.sln
*.suo
*.user
*.pidb
*.userprefs
\$\endgroup\$
2
  • \$\begingroup\$ This is almost the same as the .gitingore I use for Unity projects but with a few ommissions: [Bb]uild/, *.booproj, sysinfo.txt. I'm pretty sure what I use is based on GitHub's new-repo templates for Unity (github.com/github/gitignore/blob/master/Unity.gitignore) any Objective-C (when targeting iOS). \$\endgroup\$ Commented Dec 15, 2014 at 13:53
  • \$\begingroup\$ Internal Server Error on your blog. \$\endgroup\$ Commented Mar 6, 2018 at 15:41
4
\$\begingroup\$

Unity 3.0 is configured to play nicely with subversion. (At-least nicer than before) I don't know if this is only in the pro version or not, I'll have to check.

In general though, the most recommend version control system is the Unity Asset Server.

\$\endgroup\$
4
\$\begingroup\$

Unity specific - work on different scenes and different code files at all times, and merge in the other person's changes manually. If you both need to be working on the same scene, duplicate it and use the copy as a test. Otherwise, if you both modify the same scene, one person's changes will overwrite the other. You can still use source control for your source files, just don't move them around at all, in the file system or via Unity, once they're created.

Beginner advice - get yourself a decent diff/merge tool (I like WinMerge) and get used to using it to see what changes the other person made, and to manually merge changes in conflicted files. Set up a central documentation space, eg. a Google writing document or a wiki, and keep your documentation there - documentation should contain a basic feature list at a minimum so you know what you're aiming for, and ideally a task list derived from the feature list, along with a clear indication of who is working on the task. Talk to each other to get a rough idea of who needs to work on which task and cross them off the list as they get done. Keep revisiting and re-evaluating the list to see if everything is still valid and if you need to rework any priorities.

\$\endgroup\$
1
  • \$\begingroup\$ Thank you! You gave me great advices on both of my problems. \$\endgroup\$
    – nosferat
    Commented Dec 17, 2011 at 20:21
4
\$\begingroup\$

I work with a team that calls itself Defective Studios. We've struggled with the same issue for years, and just recently I finally gave in and started writing an extension to help me merge gameobjects.

Basically the approach is to create an inspector-like interface in a window that lines up each gameobject, component, and property side-by-side for comparison, and provides buttons to copy values (or whole objects) from one side to another. If you're familiar with the SerializedProperty class, that's what is doing the bulk of the work here. We basically create a GUI that synchronizes the foldout state between the right and left side, and creates vertical space wherever a GameObject or Component exists on only the right or left side. A comparison function checks equality at each level, and turns the background of each line to red or green depending on the state of the equality. Any line whose children contain a difference will also become red, and we also included a nifty button to recursively search the tree and expand all objects that are different or have differences in their children.

As well, there is a set of mask fields that let you filter certain component types out of the comparison. GameObject attributes like name, layer, and tag are also compared. We use SerializedObject and SerializedProperty to loop through the gameObject's properties, and draw them just like they're drawn in the inspector. This ensures consistency, and is a heck of a lot easier to code!

enter image description here

One last nifty detail is that the comparison process (triggered when the objects are loaded and whenever a change is made) is run in an ad-hoc coroutine that is updated by the EditorWindow.Update function, so that in case you are comparing a hugely complicated object, the window doesn't lock up the editor. This was a must when comparing objects with hundreds (or thousand!) of children. All in all, it was kind of a "lego project" as my friend likes to say, but definitely an invaluable tool which instantly became a part of our collaboration workflow.

The tool, Unity Merge is documented on the Unify wiki, which includes a roadmap and an e-mail address for feedback and issue reporting. If you're really struggling with a complicated merge, give it a shot and let us know what you think! Also, I didn't bother to build it into a DLL, so feel free to poke around at the source. The ad-hoc coroutine implementation and SerializedProperty manipulations, as well as a few GUI tricks that I ended up needing are a great part of your editor extension toolkit. I'm very interested in changes/improvements that users might have, so please get in touch!

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Sounds like a useful tool, thanks for improving your previous "link only" answer. \$\endgroup\$
    – House
    Commented Jul 10, 2013 at 2:50
1
\$\begingroup\$

If you have the funds for it, the Asset server with the pro version of Unity is pretty decent. I have used it on a large, multi-person project in the past and it did the job. For vanilla version control, it did what we expected it to do.

I've tried using an SVN repository with a Unity project and it was a bit of a hassle. We ended up scrapping the idea before getting it to work, however. Unity keeps a lot of backup files that I didn't want to take the time to find out what would happen if they weren't synced to the server. I think, with a little finesse, it could be doable but I haven't had experience with it working well.

I have done a small project using the free features of DropBox. It made me nervous but we never had any issues. And, I don't think we ended up needing any real version control stuff for that project so I can't speak much to how reverting or merging files would have gone.

\$\endgroup\$
1
\$\begingroup\$

Dropbox supports versioning per file (rather than per commit) and plays nicely with Unity. It is free initially (2 gigabytes) and quite cheap thereafter (about $10 for 50gig). You need the PackRat addon to have access to version history.

Just like with SVN, CVS, GIT etc., you will need to make sure you create tag folders when you get to each key stage in development (eg. end of week, end of milestone). Unlike the aforementioned, it will be much harder to revert to such a stage if you don't, because you would have to revert every single file individually. Bear that in mind while developing and you'll have an easy time without paying for the Asset Server.

\$\endgroup\$
5
  • \$\begingroup\$ This is sooooo painful though. Unity has to rebuild the scene everytime you open it on a different computer. This changes the library folder in a lot of places for each commit. Ignoring the library folder would be nice, but then you wouldn't have version controlled scene files. My team gave up and bought a bunch of pro licenses and used asset server. \$\endgroup\$
    – brandon
    Commented Jan 27, 2012 at 19:06
  • \$\begingroup\$ @brandon Guess it depends on project size. \$\endgroup\$
    – Engineer
    Commented Jan 27, 2012 at 19:34
  • 1
    \$\begingroup\$ Definitely, if it's a couple of devs with limited budget, I would suggest your approach as it's really the only one \$\endgroup\$
    – brandon
    Commented Jan 27, 2012 at 20:20
  • \$\begingroup\$ But have you ever worked on a project which stays under 2 gb? what about the models and textures you will be including. Have a look at bitbucket.com and start learning git! \$\endgroup\$
    – XandruCea
    Commented Aug 31, 2015 at 10:29
  • \$\begingroup\$ Absolutely. Android/iOS projects definitely stay well under that size in my experience (during the year I wrote this answer). Also, you can earn more space on Dropbox by inviting friends. \$\endgroup\$
    – Engineer
    Commented Aug 31, 2015 at 11:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .