- Home /
AssetBundle - Missing Mesh
Im working on an EditorScript that dynamically imports an FBX, and then builds an AssetBundle from this FBX. However, when I load in the AssetBundle, the meshes are all missing.
GameObject _prefab = PrefabUtility.SaveAsPrefabAssetAndConnect(
_FBX_Asset,
"Assets/_Imports/test.prefab",
InteractionMode.AutomatedAction);
string assetPath = AssetDatabase.GetAssetPath(_prefab);
AssetImporter.GetAtPath(assetPath).SetAssetBundleNameAndVariant("testbundle", "");
BuildPipeline.BuildAssetBundles(
"Assets/_AssetBundles",
BuildAssetBundleOptions.None,
BuildTarget.StandaloneOSX);
And to load, I use;
var myLoadedAssetBundle = AssetBundle.LoadFromFile("Assets/_AssetBundles/testbundle");
GameObject[] prefab = myLoadedAssetBundle.LoadAllAssets<GameObject>();
for(int i = 0; i < prefab.Length; i++)
{
Instantiate(prefab[i]);
}
What am I missing here?
I haven't tried in such manner but have you tried AssetDatabase.SaveAssets and AssetDatabase.Refresh after SaveAsPrefabAssetAndConnect?
It should be fine without but just in case.
. Bump any ideas? $$anonymous$$y materials are also missing too. But I cannot tell what I am doing wrong here?
Did you find an answer to this already. I have the same problem. Textures and $$anonymous$$eshes are missing
Answer by trul · Feb 11, 2020 at 07:36 PM
I had similar problem. Check the last line in bundles manifest file for dependencies Dependencies: [] In my case the model or prefab were depended on other models and materials. In this case you should load the first or pack them in the same bundle.
Your answer
