我正在使用下面的代码,如果捆绑包仅是第一次安装它就可以工作,否则我会收到捆绑包已经存在的错误。所以我的问题是如何检查捆绑包是否存在,如果存在,从缓存文件中读取它
IEnumerator DownloadAndCache() {
while(!Caching.ready)
yield return null;
using (WWW www = WWW .LoadFromCacheOrDownload(bundleURL, Version)) {
yield return www;
if (www .error != null)
throw new UnityException("WWW Download had an error: " + www .error);
// Must add check mechanism here
AssetBundle bundle = www .assetBundle;
// bundle.Unload(false); this doesnt work
if (AssetName == "") {
mBundleInstance = Instantiate (bundle.mainAsset) as GameObject;
mBundleInstance.transform.parent = cloudtarget.transform;
}
else {
mBundleInstance = Instantiate(bundle.LoadAsset (AssetName)) as GameObject;
mBundleInstance.transform.parent = cloudtarget.transform;
}
}
}
谢谢