how can I export a prefab modified from fbx model?

There is my operation:

  1. drag fbx model to hierarchy.
  2. modify game object structure.
  3. create prefab of the game object.
  4. export prefab to Asset Bundle.
  5. load Asset Bundle through WWW.

When I load the game object from AssetBundle, the structure is same as original game object that created by dragging fbx model to hierarchy.
And I found if I substitute the material and delete origin material in step (2),the game object load in step 5 change to pink.

Is anyone know how to fix it or give another method to fulfil the need of exporting the prefab modified from fbx model.Thanks!

I’ve been running into similar issues. I fixed mine by making sure my fbx has a different name than the prefab I generate. It’s almost as if sharing the same filename causes unity get confused as to what it should do.

From what I can tell, if the fbx and the prefab share the same name (extension doesn’t matter) then when I load the prefab from the asset bundle it’ll try to load either the fbx or the prefab. And of course, if it loads the fbx, it will be wrong and missing dependencies because I changed them on the prefab.

Makes me wonder if adding a prefab to an asset bundle causes a bunch of things to be added (materials, textures, fbxs) and everything is defined in the asset bundle by file names without extension or directory. Which would be terrible.

It’s not bad idea to name model and prefab the same, however it’s true that usng just name without an extension, unity will pick fbx over prefab. Therefore the best and safe practice is to check all attached elments in asset and look for a prefab:

public GameObject LoadModelFromFile(string _filePath, string _modelSlug)

	AssetBundle _Bundle;
	_Bundle = AssetBundle.LoadFromFile(_filePath);
	bool _prefab = false;
	foreach (string _s in _Bundle.GetAllAssetNames()){			
		_prefab = (_s.LastIndexOf(_modelSlug + ".prefab") > -1) ?true:false;

	GameObject _Obj = _Bundle.LoadAsset(_modelSlug + ((_prefab)?".prefab":"")) as GameObject;

	return _Obj;

Safe because you can also have assets without a prefab and thanks to checking the asset boundle first you’re sure that it wont run into an error.

Just remember that when you making a prefab from fbx, before exporting them to asset boundle, make sure to choose a “prefab variant” not “original prefab”. Otherwie your prefab will not have meshes or other fbx attributes attached to it. Don’t forget to change the name after doing so, as editor will add " Variant" to the name…