Unity3D external version control

unity git

It is a pain to mantain and versioning unity projects. So this is my compilation with all hints I have found.

The main problem is you are about to put under version control binary files and text files together! It is hard or even impossible to make diff of binary files. Because of that, the size of the repository on server it will be huge, and slow in many kinds of VCS.

To speedup VCS operations, you can clean the previous versions, so the server will not store or make diffs of them. You will found this problem as your project increases. Another good pratice to speedup Unity and VCS: when some portion of our code become stable enough, you generate a library (.DLL) of them and store the code into another repository.

For those who use the pro version, you will ignore almost everything in Library folder (I put only the text files), and every automated generated file such as *.sln, *.pidb, *.csproj from root directory.

Another important thing is to enable .meta serialization and serialize everything as text. In order to do that, you must do:

  • Edit -> Project Settings -> Editor;
  • Version control mode: Meta files;
  • Asset Serialization: Force Text;
  • Save project.

With meta serialization enabled(free users cannot enable, I guess) you will not need to put the Library folder in version control, otherwise, if you are a free user, you must put the metadata under version control(This problem is related to Unity versions before 4. At the present moment you could do that, I cannot be precise, I use the pro version).

You have two choices:

  • Enable metafiles and you do not need to put into version control the folder metadata;
  • Disable metafiles and you must include the metadata folder.

I choose enabling meta files.

If you are having problems with prefabs without script and losing references, you forgot to serialize as metafiles and put them under version control.

So, I use this ignore pattern:

%d blogueiros gostam disto: