Reputation: 1423
I'm trying to implement a Git for a game project of mine. For scripts, it would work well because they are already in text. But what about scene files? They are binary files so merging them will be quite hard. What if I put a game object in the scene and another co-worker put another in the same scene? How would we merge our scenes? Or should we always export / import it manually?
Thanks in advance.
Upvotes: 5
Views: 4475
Reputation: 679
I've created the PythonUnityMerger for resolving merge conflicts in Unity3D scenes and prefabs. It will interactivly help you to resolve the merge conflicts while giving you a hint of what the conflicting property means. It has still some limitations, but it's OpenSource so feel free to contribute.
https://github.com/aisc-digital/PythonUnityMerger
Note: as @Heisenbug explained you will need to change the save type from binary to text first...
You can save scene files in text mode:
Edit->Project Settings->Editor->Asset Serialization: Force Text
Upvotes: 2
Reputation: 1762
Here's how your team can manage to work on the same Unity scene file and merge it rather smoothly using Git.
Make all GameObjects in your scene prefabs. That way, they can each be edited individually.
Ignore the scene file from your .gitignore file.
Whenever you're making changes in your scene, make sure to apply your changes to your prefabs.
This way, whenever you pull your colleagues' repos, you're not pulling their scene but rather just their prefabs in their scene. So your scene will reconstruct itself with all the latest changes in the prefabs from all your team resulting in a smooth-ish merge.
If you structure your scene well enough, I think this system will work.
Upvotes: 2
Reputation: 39194
You can save scene files in text mode: Edit->Project Settings->Editor->Asset Serialization: Force Text
This way scenes are saved as Yaml
file, for more details on the format, have a look at the doc.
Despite I sometimes merge scene by hand, it's not a trivial operation, and you must be very careful (git automerge isn't able to merge them properly in 99% of the case).
Upvotes: 8
Reputation: 462
Generally holding binary objects in 'source' repository is controversial idea. However recently some specialized tools have appeared http://wiki.unity3d.com/index.php/UniMerge ... so they can be bought or written from scratch.
Upvotes: 2