以下のコードを使用しています。バンドルが初めてインストールされる場合にのみ機能します。それ以外の場合は、バンドルが既に存在するというエラーが発生します。私の質問は、バンドルが存在するかどうかを確認する方法です。存在する場合は、キャッシュされたファイルから読み取ります
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;
}
}
}
ありがとうございました