- Home /
What is the right way to update a Prefab in a team environment?
Currently we're using Unity Pro 4.1.5 and our project is checked into Git. I'm new to Unity but as I understand it, to make changes to a Prefab
you drag it from the Project
into your Scene
(to instantiate a working copy), make changes in the Inspector
, apply those changes back to the prefab and then remove the instance from your scene.
However, in even the most basic instance - changing the position of an embedded GameObject
and pressing the Inspector's Apply
Prefab button - the resulting changes in the .prefab
file are extensive and unexpected. The diff contains hundreds of changed lines on child objects that I did not modify - things like "serializedVersion" being incremented, "m_Enabled" flipping from 0 to 1, "m_Script" attributes changing their 'type' from 1 to 3 and more.
The "m_Enabled" change is the most troubling - if the Prefab was setup to have disabled parts by default, why are they being instantiated as enabled and why are those changes percolating back to the Prefab when I did not press Apply on any child object except the one I repositioned? When the game is played, the Prefab is broken because all child components are enabled by default.
I've had to manually go line-by-line through the diff and revert the unnecessary changes leaving only one change to "m_LocalPosition" attribute before I commit. When I do this, the game plays as expected and the element I repositioned appears in the correct spot.
I feel like I must be missing something obvious - what do I need to do to prevent Unity from generating hundreds of unnecessary changes to the .prefab file? What is the right way to manage this on a team when it appears so easy to inadvertently change objects? Thanks in advance.
I am also a bit curious about this. Up until now, I am just being very careful not to update any non-source object in two places at once, but in a larger $$anonymous$$m this can be impossible to enforce.
Your answer
Follow this Question
Related Questions
Every Single Object "Missing Prefab" after Git Revert 1 Answer
Does Git or SVN work better with Unity? 6 Answers
SourceTree - UnityYaml doesn't open 2 Answers
Git and .scene/.prefab 2 Answers