Hi, I followed the chapter "Build the AssetBundles" (https://docs.unity3d.com/Manual/AssetBundles-Workflow.html) and added a prefab to an assetbundle (means: selected the prefab in Project-view, in inspector window at the bottom I clicked the assetbundle-dropdown -> new and entered a new name. After clicking on "Assets" -> "Build AssetBundles" build starts and as a result I can find 8 new files in my Assets/AssetBundles directory:
- myprefab
- myprefab.manifest
- myprefab.manifest.meta
- myprefab.meta
- AssetBundles
- AssetBundles.manifest
- AssetBundles.manifest.meta
- AssetBundles.meta
As far as I unterstand documentation I should only get one single file as a result?
When I try to load in unity emulator the assetbundle on runtime with
public class LoadFromFileExample extends MonoBehaviour {
function Start() {
var myLoadedAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "myprefab"));
if (myLoadedAssetBundle == null) {
Debug.Log("Failed to load AssetBundle!");
return;
}
var prefab = myLoadedAssetBundle.LoadAsset.("MyObject");
Instantiate(prefab);
}
}
I get no error and I can't see my prefab in the scene - down't know what went wrong :/
↧