我正在尝试加载场景,但我从标题中得到错误,我根本不知道为什么,因为我在 AssetBundle 上调用 Unload(false)。有人能帮我吗?谢谢。
void Start() {
...
StartCoroutine (DownloadAndCache());
...
}
IEnumerator DownloadAndCache (){
// Wait for the Caching system to be ready
while (!Caching.ready)
yield return null;
// Load the AssetBundle file from Cache if it exists with the same version or download and store it in the cache
using(WWW www = WWW.LoadFromCacheOrDownload (BundleURL, version)){
yield return www;
if (www.error != null)
throw new Exception("WWW download had an error:" + www.error);
AssetBundle bundle = www.assetBundle;
bundle.LoadAll();
AsyncOperation async = Application.LoadLevelAsync("main");
Debug.Log (async.progress);
yield return async;
bundle.Unload(false);
}
}