Our project is being developed by a small team, so we are using version control software (Perforce) with Unity Pro. We have set up our file versioning to behave as suggested by this page:
Most of our game objects are instances of prefabs. When one of our artists updates an FBX or an animation file, updates the prefab, then checks in the changes, those changes cannot be seen by anyone else.
In the case of an updated FBX, the new version of the model simply is not seen in the prefab. The old version of the model is still visible. The user must manually re-apply the FBX to the prefab, and then the new model shows up. (However, the preview window still shows the old version of the model)
In the case of an updated animation, the prefab often says "Missing Animation Clip" in the Animation section. The user must manually browse for the animation to re-associate it with the prefab.
I discovered one bit of information about the missing animation problem. I opened one of the problematic prefab files in a text editor and saw some references to locally cached animations: "library/metadata/3b/3b9331fc2712fb04a96b1dff65d4a798...email@example.com". We're not even doing version control of the "library/metadata" folder, so it seems questionable that the prefab is directly referencing this data.
At any rate, the prefabs seemingly work fine for the artist that is modifying the model or animation. There is only a problem when someone else tries to see the changes. While it is POSSIBLE to fix this locally on each user's machine for each piece of artwork every time a revision is made, it certainly is not a desirable workflow.
Has anyone figured out any way to reliably use prefabs in conjunction with version control software? I have seen a few posts about this, but the answers are generally work-arounds that involve re-exporting art locally or re-creating prefabs every time the art is updated. Are prefabs just not designed to ever be modified?
asked Nov 18 '10 at 01:44 AM
As far as I can tell, this is not related to using version control. We've always witnessed strange behaviour when updating FBX assets that are instantiated inside prefabs. I guess that what Paulus Liekis says in a comment to the other answer is probably correct, meaning that changes to an FBX inside a prefab may be correctly replicated as long as the update only changes the vertice/faces/materialIdxs of the mesh, but not if it is the bones or subobjects (adding/removing animations, I'm not certain of also). This is linked to the fact that Unity does not handle nested prefabs I guess - which is a pity really.
Anyway, what we do is maintain a clear separation on the fbx within the prefabs - they are never the parent of anything, nor referenced explicitely in the scripts in their parent (references are usually rebuilt at runtime through a GetComponentInChildren), so that when an FBX is updated, we may erase its instance(s) in the prefab(s) and recreate it. For our most recurrent cases we store the prefab next to the fbx with the same name, so that it's easy to parse all fbxs, get the prefabs that uses them, and apply that destroy/recreate/apply automatically through an import script. This is done only once after the fbx reimport - preferably by the artist who modified the fbx - and once committed to perforce everybody get the correct version.
Admittedly, that's far from ideal, but we manage to live with it with a 15+ team.
Hope this helps,
answered May 02 '11 at 06:06 PM
Man, I put my vote in for this to be the #1 fix I would like to see to Unity! Allow artists to update models and have prefabs pick up the changes.
I got kicked hard with this issue- after building a really fun game over the course of a few weeks with temporary graphics, time came to update to real art and boom! Models dissapearing, turning to vertex pizza, and pain, pain, pain. Since I built everything in prefabs, It now looks like I have to manually go through and recreate absolutely everything. Yay.
I am worried about commiting all that time unless the workaround is solid...
So I create a null parent and put all my scripts in that, then at START() instantiate the model which I link in. I suppose I could put in a temporary mesh in the heirarchy that I delete on START so I can see where the model is being placed in the editor, right? Then on start, hunt down the bones I need to attach weapons, colliders and particles to by name?
Does anyone have an example chunk of prewritten java for this?
Do you have .meta files enabled (i.e. "external source control" in editor settings)? - IIRC, when having .meta files enabled you shouldn't have to care what's happening in library folder. Are you sure your prefab connections are not broken?
I used Perforce with Unity and I can't remember having problems like this.
answered Nov 18 '10 at 08:27 AM