We are starting a project using Unity Pro with asset serialization set to Force Text, enabling Unity Pro’s YAML files. However, we are finding it difficult to merge our work together. I’d love to hear advice from other medium/large teams working in Unity.
• When multiple people work on a scene or prefab simultaneously, are they able to make non-conflicting changes in different areas and merge their work together? Or have you had to resort to exclusive checkouts where only a single person can work on a file at any one time?
• We are using an external source control system. (Visual Studio TFS.) Would there be advantages to using Unity’s own asset server?
Right now our biggest problem is that whenever someone touches something, Unity creates tons file differences unrelated to the change they are making. It appears that adding a member to a script or changing a prefab often induces data changes in other prefabs, scenes, etc. But Unity doesn’t apply those effects until those other assets are manually opened and saved in the Unity editor. As people are working, they are just checking in changes to individual files. But when other team members get those changes, it causes changes to other files that they are using. The other team members don’t understand where those changes came from and, just looking in a diff tool, their changes become lost in a sea of unrelated differences. Confusion and merge conflicts ensue.
• Does that sound like how the Unity editor is supposed to work?
• Anyone have a solution so that people will only have differences on their local system from things they themselves changed? I have written a script to dirty and resave every asset and scene in the project, and I’m thinking of requiring everyone to run this before checking in, but I’m interested to hear if there is a better solution.
Any other general advice on merging work would be greatly appreciated. Thanks!
-Forrest
Hey Forrest, welcome to the community. I’m afraid I can’t give much feedback on this, and someone else will likely be able to help you out more than I could. I have noticed that Unity doesn’t enjoy transferring files from one project to the next (textures, tags, etc, seem to get broken). And I’ve only briefly worked with Unity’s Asset Server.
I would suggest you post this in the Support forum. You may get a better response there.
My teams aren’t particularly large, generally 2 to 3 people for a Unity project, but we don’t have the issue you’re describing above where one change causes a cascade of unrelated changes.
If Unity is creating lots of files as you’re doing stuff, that suggests to me that you may not have your project configured properly for version control. Is your version control mode set to use .meta files? Do you have a Library folder sitting alongside your Assets folder (you shouldn’t)?
Anyway, we use Git for version control, and as long as Unity’s instructions for external version control usage are followed we haven’t had any real issues with it at all. And while we do stick to exclusive modification of things like scene files and prefabs, my (limited) testing showed that if I make non-conflicting changes to a scene on two different computers and then merge them things work as expected.
As for the Asset Server, we’ve used that on projects in the past and find that we prefer Git. The Asset Server is more nicely integrated, but has pretty limited functionality compared to more standard version control systems.
This is what the package functionality is for - preserving relationships between assets when transferring them between projects. Files are just the things that asset data is loaded from. The difference between files and assets is subtle, but very important. There are no relationships between files themselves, the relationships are between the assets.
Yes, it is annoying “feature”. There are few other annoyances u may not be aware.
When you import packages, if it was in binary (usually they are). They are not converted to text mode when you load in your project. You have to for a Reimport All.
The prefab data is stored in the scene, so prefab changes, the scene don’t change until the next time you open them, accounting for the massive changes.
So make as much prefab as possible and let one person modify the scene only.
There is a tool in AssetStore SceneMerge which will sort the scene file but I have not tried it myself. I’m still living with the pain.
The biggest problem I have with Unity is scene merging, as many have said before.
My experience is that as long as your don’t change the same item/object in a scene; the scene will merge fine.
So if your hierarchy is;
GO 1
— GO 2
----- Prefab 1
— GO 3
----- Prefab 2
If two developpers change GO2, you’ll probably end up with a broken scene. If two developpers change prefab 1 and 2 or GO 2 and GO 3 respectively, it should be fine at merging.
The only safe way to work collaboratively on anything else then text/scripts files is in an exclusive manner.
We also use ‘buffer’ scenes (each developper has a personnal scene) in which you can work on and copy/paste finished content to a ‘master’ scene. Ex;
(all in Unity)
Copy hiearchy from a ‘master’ scene
Open ‘buffer’ scene, paste
Work on GOs, placing objects, creating the scene hiearchy
Copy only the work done
Open the ‘master’ scene, paste / add / replace with new work.
All transforms will be preserved and the hiearchy will be clean. Of course, you need to train the developpers to follow a rigid workflow and communicate between themselves but it beats exporting unity packages. Obviously, this is still exclusive, so the ‘master’ and ‘buffer’ scenes can only be worked one dev a time but it allows the master scene to be available much more often.
If we can, we also distribute the work load to have content creator / content integrator into two seperate tasks / devs.
Oh and the Cache Server (not Asset Server, Cache Server) is a given requirement for fast work with version control systems.
This sounds like you have the whole project under version control. What is actually needed is only the Assets folder and ProjectSettings, everything else will be generated automatically if they don’t exist.
As mentioned, you definitely don’t want Library in version control. Even with that, merging scene files is often unwieldy with Unity. IME, scripts are the only thing that can be freely merged. This is especially true if you use any components that create temporary objects, such as EZGUI - the result will be dozens or hundreds of changes in a scene file, even just for opening and saving it.
The asset server doesn’t seem to change this - the main benefit is that you can commit/update directly from Unity and it will identify dependencies to commit.
If you set things up as per the version control instructions you shouldn’t have a Library folder at all. At least, after following those instructions with Unity Pro the Library folder has never showed up again for me (and the instructions do involve deleting it if it’s already there).
Even the docs say it’ll be recreated. It just has to be local. Skipping the step about deleting your library folder and instead just not versioning it will also work just fine.