Part 04 - Git and Unity.
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.
- Part 01 - Installation
- Part 02 - Concepts
- Part 06 - Adding some plugins
- Part 07 - Creating some objects
- Part 08 - Physics
- Part 09 - Pushing things & animation
- Part 10 - Pushing coins
- Part 11 - Custom Scripting
- Part 12 - Spawning things
- Part 13 - It is still too fast
- Part 14 - Coins are piling up
- Part 15 - Materials
- Part 16 - User control
- Part 17 - Keyboard input - Fire
- Part 18 - Keyboard input - Movement
- Part 19 - Deleting Coins
- Part 20 - Walls
- Part 21 - Adding a GUI
- Part 22 - Adding the GameController
- Part 23 - Scoring links with events
- Part 24 - Refining the Game - Part 1
- Part 25 - Refining the Game - Part 2
- Part 26 - Refining the Game - Part 3
- Part 27 - More refinements
- Part 28 - Slowing the user down
- Part 29 - Some more changes