10

I'm a bit confused how to use version control with Unity, especially with objects such as scenes or prefabs that are not just code.

We had an issue recently when my colleague and I were working on different parts of the same scene. which resulted in conflicts, branching and merging galore.

In the end my revision was overridden by his changes anyway.

The only way I see at the moment is us taking turns working on the same objects, but it doesn't seem very convenient, especially since all of the work we're currently doing is in the scenes.

What do people usually do in these situations?

(We're using Mercurial, BitBucket, and SourceTree.)

  • 1
    Erm. Care to comment why I was downvoted less than 5 minutes after asking? I can't make the question better if I don't know what's wrong with it. – Kaworu Apr 15 '16 at 14:11
  • 2
    I've also run into this. You can put the scripts in no prob, but scenes etc seem harder – Ewan Apr 16 '16 at 6:13
  • 1
    Are these scene files text files that are hard to merge or are they binary files that are more of less impossible? If they're binaries, Unity seem to provide merge (and maybe diff?) tools for that. – Nathan Cooper Apr 19 '16 at 21:28
  • @NathanCooper They're binaries as far as I can tell. At least they behave like binaries, and opening them in a text editor gives me the same load of mumbo-jumbo as any other compiled file. I didn't know about Smart Merge. Thanks! – Kaworu Apr 20 '16 at 9:21
5

You can try following solution if you're using GitHub.

  1. In unity open Edit-> Project Settings -> Editor, then in Inspector of project Settings.
  2. Change "Version control mode" to "Visible meta files".
  3. Change "Asset serialization mode" to "Force text".

This works fine for me.

3

Most version control systems (VCS) are designed for text. They usually have very powerful and convenient features for comparing (diff) and merging source code, and some tools can even automatically merge changes (and do a decent job of guessing how changes should be merged and at what point the developer should be solicited to do a manual merge).

It would be great to have a better support for diff and merging of binary files from the respective applications which use those files. Microsoft Word, for instance, makes it possible to compare two documents, and while it's far from being a convenient merging tool, it's still better than nothing and saved me hours on multiple occasions. Unfortunately, the merging feature is usually either overseen in software products, or difficult to implement (how do you visualize a diff of a 3D scene?)

When it comes to binary files, you get little help from VCS. Not only are they unable to store successive changes efficiently, but they can't help you merge the changes either.

Two years ago, I asked a very similar question concerning version control use in video editing software. I believe that answers which were given to my question partially apply here as well, the only (but important) difference being that my question concerned large files, while in your case, binary files are probably relatively small.

The approach you found, that is “taking turns working on the same objects”, is the good one. If you can't merge, don't work in parallel on the same stuff. If you work in the same office, it could be easy to do. If not, most version control systems (including the one you use; it's also discussed here in a context of BitBucket) support locking, which consists for the user of a VCS to tell, through the system, that he's working on a given file right now; other users can load the latest version of the file, but they are not expected to change it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.