Hacker News new | ask | show | jobs
by keerthiko 4327 days ago
We build BitGym (www.bitgym.com) using Unity, and it has a lot of moving parts and 2-3 developers working on scene, code and assets, and we've made it work with git. It really comes down to developing and maintaining some best practices:

- Always use prefabs wherever possible. But avoid nesting prefabs

- Always save your prefabs, then save the scene before pushing. Thus the .prefab files are also updated through git: these are more robust and have higher priority than the scene.

- Make sure source control uses meta files (unless you're using Unity's Asset Server) so that scene references are stored again in separate files updated through git.

- Make sure individual developers have a lock on individual prefabs. Unlike scripts, Unity will bomb changes from one side of the merge on binary files, but this is expected when using git on binary files. Of course you can treat the scripts as any other code project, and they merge fine.

It's still not ideal, and we occasionally wind up with merge issues or a day of having to carefully iron out scene conflicts when doing larger branch merges, but they haven't been so dreadful as to make us decide never to use it again because of the collaboration issues.

2 comments

That's very helpful, thanks! One question...

> Make sure individual developers have a lock on individual prefabs.

Can you elaborate on that? Git doesn't have file/directory locking unless you use something like gitolite, so what kind of locking do you mean?

I found UnityLock in the asset store, which is supposed to let you lock assets against editing, but it doesn't seem to work in 4.5:

https://www.assetstore.unity3d.com/en/#!/content/4851

The code seems straightforward enough, so I may see about getting it working if the author doesn't do it.

Yes to this! You can also use the additive scene loading to build pieces of your product independently of each other and pull them all together at runtime.