Hacker News new | ask | show | jobs
by klodolph 4323 days ago
I've been bitten before by some of the problems regarding Unity and collaboration with source control. Everyone wants to test out their changes on the same scene, but it just blows up when you go to merge... even if you use a dumb merge strategy like ours or theirs (as a Git user) it seems to break things. Unity seems really cool, but I'm never going to use it again for any project with more than one programmer.
1 comments

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.

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.