How can I keep the prefab connection when re-export an fbx with added objects ?

I created a prefab and added functionality to it (scripts, colliders, rigidbody). After adding the components, I click "apply" to re-establish the prefab connection. But when I export an updated version of the fbx file that contains new objects, these do not show in Unity. If I drag the fbx onto the prefab, it gets overwritten and all added components disappear.

Is there a workaround or an asset post-processor script that can help out here ?

Seems to me that its a normal fact of life that during development objects get added. I can't believe that a workflow-oriented tool like Unity cannot handle this.


To clarify my question, consider this workflow :

  • In max create a teapot
  • Export to teapot.fbx
  • Create empty GameObject
  • Drag the teapot into the hierarchy view as child of the GameObject
  • Add components to the GameObject and/or teapot
  • Create prefab
  • Drag GameObject onto prefab
  • In max add another teapot and re-export to teapot.fbx

The second teapot is not added to the prefab. What workflow allows me to update the teapot prefab and keep the existing components ?

In general, I wouldn't recommend directly adding models to the scene and modifying them (which does break the prefab connection and as you have experienced - that's not so easy to fix in this specific case).

Instead attach the models as child objects of empty game objects and attach any scripts and other components to this empty parent game object instead of to the model. That way, you can easily update your models without any problems. You can also create a Prefab from the parent object (and then use that instead of the actual model).

You can see the difference between a "model pseudo-prefab" and a "real prefab" by looking at the icon (it looks a little different).

You can easily access your "model game object" from the prefab ("parent game object") in scripts by adding a public GameObject member variable to those scripts. Like:

public GameObject model; // C#

var model : GameObject; // UnityScript

Then, all you need to do is drag the child object (which is your model) onto the slot in the property inspector of your script in the parent object (which is your prefab).

Another nice thing about this approach: You can easily extend this without breaking all your scenes, e.g. you could include different poly-versions of the same model and then dynamically show/hide the different versions (as needed), which would be the foundation either for your own custom LoD (Level of Distance) implementation, or could also be used to dynamically switch models with different complexities based on framerate.

If you use the models directly, and then at some later point in time decide you want to do something fancy, "conversion" might be extremely painful (been there, done that, got a T-shirt ;-) ).

When you reexport your art, if the name of the mesh in the fbx hasn't changed, then your updates should be reflected without issue.

When you say that the prefab does not show in Unity, does that mean that the mesh disappears? If so, check the inspector. Does it say Mesh Filter [None], Missing (Mesh)? That means you've somehow confused Unity... maybe by changing the name of the mesh?

We have a similar problem, everytime my graphic update me with his new levels, we are in a nightmare, because ONLY if I copy HIS "assets/library" folder I get their level right, but this is not gonna play good, with my project library folder and my levels!

Is this perhaps somehow related to the internal importing library folder?