When Prefabs Go Bad
Unity Pro 5.3.4f1
I had something happen in my scene and my main prefab got wacked. I am not sure what happened but it has taken a long time to get the prefab back to working properly again.
Basically, many of the sub-objects of the prefab had various components on them. When the prefab got wacked, many of the components on the prefab objects got moved to other objects within the prefab. In the attached image, you can see that there are two Mesh Colliders which are displayed when the prefab is selected. These mesh colliders have been moved from their original, proper objects to other objects in the prefab. In addition, the Animation component of the prefab which had been on the top-level prefab object 'valve_FBX' was moved on to one of the sub-objects of the prefab. Two Unity cameras which were in the prefab hierarchy are gone (deleted) from the scene. And the hierarchy was re-arranged. I still don't understand what happened that caused the prefab to be wacked.
But all this brings up larger questions about prefabs and the best (safest) way to work with imported mesh objects.
(In an ideal world, I would do most of my scene setup in my 3D application and import that scene into Unity. But I am finding that is very difficult with the way Unity works. Materials barely (really don't) import, lights don't import, animation does not import purely (Unity does not preserve the precise values of keys... it bakes it's own version of the FBX keys). And now, prefabs are fragile).
If I have a complex hierarchy of objects that need to be animated... I structure the hierarchy and animate in my 3D application... this is logical. Then when it's time to export to Unity, I select all the hierarchy and the lights and the cameras and export to Unity as a single FBX file. When I examine the FBX in Unity the hierarchy seems to be correct. (The lights and cameras don't import but there is a node for each in the hierarchy).
In general, this seems to be (work) OK... until something bad happens like the FBX prefab getting wacked. Then it is a nightmare as the complex prefab now has missing sub-objects, components moved to wrong objects, and the hierarchy re-arranged.
Had I exported each object as a separate FBX (which would have been a pain... unless there is an automated way of exporting each separately), I would have then had to re-build the hierarchy to match the hierarchy of the 3D application. But perhaps only a single object might have gotten wacked instead of the entire prefab which might have made recovery SO much easier.
Just wondering if other find prefabs fragile? Should I export objects individually from my 3D application?
Thanks for any ideas!