Models vs prefabs

When I export a single object as an FBX with Blender and import it in Unity (without materials, rig or animations), there appears to be two different parts to the fbx in the browser tab. First is the FBX container itself, whose name is the file name of the FBX. Second, if you click on the arrow on the FBX thumbnail, there is the mesh itself, whose name is the object name within Blender before export.

If you drag just that second part (the mesh) into the scene, it appears bright pink (no material assigned) and the object name is in black in the hierarchy window. However, if you drag the FBX file in the scene, the following happens:

  • The default material is assigned to the mesh
  • Its name appears in BLUE in the hierarchy window, as if it were a prefab. If you right click it, there is even the option “Select prefab”
  • There is a set of options as well as the mention “model” (where the mention “prefab” usually is) in the top section of the inspector when the object is selected (see picture). The options are the same as with a prefab, but instead of “apply” there is “open” and the “revert” option doesn’t seem to do anything.

It is also possible to make a prefab out of these two different “types” of objects.

So, dragging the FBX “container” instead of the mesh creates an object which shares characteristics with a prefab, althought it isn’t one. What is that about and where is it documented? What is the difference between the two in terms of workflow? Also, would there be any difference between a prefab that is made with the FBX “container” vs one made with the mesh only? I couldn’t find anything about it in the documentation.

Thanks,

2 Likes

It is just a model asset, it isn’t a prefab.

It’s actually a pseudo-prefab type. If you check PrefabUtility.GetPrefabType for the object, you get ModelPrefabInstance.

There isn’t much to it - select and revert does the same as for a prefab, but Open opens it in whatever program is set to edit the file type. It’s conceptually… somewhat like Apply, I guess?

If you want the object to be a real prefab, just drag it into the scene, and drag it from the scene into the project window.

1 Like

It shares some characteristics of a prefab, however it lacks the single most important part of prefabs, the ability to make and apply changes to the original and have those changes propagate. Import settings can be altered, but everything else is baked.

Practically speaking, just treat it like an image or any other source asset. It’s contents are applied to game objects, which happens automatically when you drag it into scene (like a sprite). As @Baste pointed out, if you want a proper prefab, drag it back into the project and use that.

2 Likes

be careful when making it a prefab, if a model has multiple nodes as some do when animated etc and if those node transforms change, the transforms will not be updated inside a prefab made from that model. You will then need to recreate the prefab. I tend to instantiate models at runtime or create an editor script to allow for fast and easy updating of models used in prefabs where complex hierarchies exist.

3 Likes

Indeed. In that case you want to be aware of that and take care not to tweak the positions, or to not rely on them. In those instances I prefer the editor scripting (tooling/pipeline approach).