我构建了一个名为“ test1.rock1”的AssetBundle文件,并将其放在驱动器d上:\ 现在我要加载它,但是失败了。
void Start()
{
var myLoadedAssetBundle = AssetBundle.LoadFromFile("d:\\test1.rock1");
if (myLoadedAssetBundle == null)
{
Debug.Log("Failed to load AssetBundle!");
return;
}
var prefab = myLoadedAssetBundle.LoadAsset<GameObject>("rock1");
Instantiate(prefab);
myLoadedAssetBundle.Unload(false);
}