Part 04 - Git and Unity.

By Jamie Chatterton / June 12, 2018

Version Control and Unity is possible, it's just a little messy.

Problem 1

Unity creates 'meta' files. It basically creates a uuid for every file in the filesystem and creates a file called <filename>.<ext>.meta and puts the uuid in there.

The idea is so that it can identify all files by this identifier instead of the file name. It's so that files can be renamed and not lost.

Solution for 1

Make sure meta files are stored as part of the push to Git. Don't ignore them as fluff. They are a single line of text normally and don't change.

Problem 2

There is a cache folder. Unity stores a cache of the state of the editor. This will be totally different from person-to-person and any big changes will make them so different that it will completely corrupt the game.

Solution for 2

Totally .gitignore the Library folder.

When using GIT to pull, delete the Library folder. Pull. Merge. Then start Unity.

Unity will rebuild the Library folder if it doesn't exist. It can be slow on a big project, it has to rebuild the entire project. But it's the only solution.

Problem 3

BIG binaries.

There are a lot of binary files in games. BIG images. Textures tend to be huge, a 2048 x 2048 x 32 bit, uncompressed image is about 16mb.

There's also MP3, WAV, MP4 movies, model files, lots of big files that could end up in Git.

Git does not like big binary files, and will not like them changing as it can't diff them and store the differences.

Solution for 3

Use Git LFS. Enable it for the remote repository. Store all large files in git-lfs. Only store the smaller files and non-binary files in git proper.

Code for this project will is in the repository and tags (or a Git hash) for each step will be signified at the end of a significant process.

More posts in this series.