如何以统一C#加载到FromFrom Asset AssetBundle?

时间:2018-07-19 09:05:44

标签: assetbundle

我构建了一个名为“ 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);
}

0 个答案:

没有答案