- Home /
Ways to Avoid conflict between prefabs in source control
I am trying to avoid the conflict between prefabs using source control, such as in branches merge or even other team member are using the same prefab, how to avoid that? or solve conflict without loosing our changes?. So any Idea.
As pretty much any other conflicting files, either with a standard merge strategy (ours/ theirs) or if you need more control by using a visual merge tool. I am assu$$anonymous$$g you are using git, not sure how it goes for other version control systems, but probably will have similar functionalities.
Answer by Cornelis-de-Jager · Nov 12, 2019 at 09:53 PM
This is what I learned from using Unity at Game Jams, and this goes for scenes as well as prefabs.
Create all the elements Separately, create your own prefab/scene or copy of the prefab/scene and test your part.
Have a designated "combiner", this person puts all the final things together. This really helps when building a scene, since conflicts in scenes aren't easy to fix.
Use specific GIT-IGNORE files: See this: https://thoughtbot.com/blog/how-to-git-with-unity
Answer by Casiell · Nov 13, 2019 at 08:13 AM
Merging Unity assets (be it prefabs or scenes) is not very straight forward and often doesn't work as it should, so I would avoid it whenever possible.
An easy way to do that is to communicate on who is editing a prefab/scene in any given moment. You cannot start your work on an object without communicating that and after you are finished you push immediately. If you failed some steps and you have conflicts then sorry, but you should take other persons work and redo yours (or take a gamble with merge, but I am paranoid and never do that).
I work in a small team on a small project so it's easy to keep track on things on Discord, but for more complex scenarios I would probably make a spreadsheet to mark which assets are currently in use. I believe there are even version control systems (Perforce if I'm not mistaken) that enforce this kind of workflow. So to start work on something you have to first claim it in the version control. Nobody else can work on a claimed asset and this state is automatically updated in real time
Your answer
Follow this Question
Related Questions
Prefabs shown as blue boxes and not previews 0 Answers
Link GUIText to a prefab? 2 Answers
Updating a prefab fbx or animation while using version-control is broken 4 Answers
Assign different materials to a range of same prefab? 1 Answer
Rigidbodies violently repel when replacing with pre-shattered opject 2 Answers