Git and .scene/.prefab

I am working on a project in unity3d that is collaborative. I have a few questions regarding git repository:

From what i’ve read, files asset serialisation mode should be Mixed but how does that actually work on .scene/.prefab? It kind of seems awful to not be able to work on the same scene/prefab simultaneously. Does it actually work?

It works but it is not as easy as with scripts.

What you can do:

  • Create a scene
  • one user at a time modifies the scene and pushes
  • all other users pull and get the modification

What you cannot do:

  • Create a scene
  • All users make modifications
  • All users pull and push → conflicts

It is possible to find ways, for instance, you can use the editor to place objects in your scene, once you found the proper place, you remove it and add it by script as script merge as supposed to.

Other way, you delegate work (this is how we do), where only the level designers can modify scenes. Programmers only program script. This way we barely get any issue.

Conflicts in scene gets fixed the same way as scripts, you open the scene file in notepad and look for the HEAD and >>>>>> and figured out which is good. Only problem is that it may require thousands of lines to be removed and it is YAML so even though you can easily read it you wont know what it does…

Not even the asset server can handle scene versionning/conflicts further than “discard server changes/my changes”.

This is a big issue, since this feature is so expensive you’d think they’d have figured out a way to handle modifications within versionned scenes.

One workaround is to only work with separated scenes, and use AdditiveLevelLoading, having each collaborator working within one, and only one, scene.

Another workaround would be to use prefabs containing the entire work of each developper, prefabs that would be instantiated at runtime when the scene is opened.