// No problem
WWW request = WWW.LoadFromCacheOrDownload(url, version);
if (request.error == null)
{
while (!request.isDone)
{
Debug.Log(request.progress);
loadingSlider.value = request.progress;
yield return null;
}
}
// Here is the problem on Android
var myLoadedAssetBundle = bundleLoadRequest.assetBundle;
if (myLoadedAssetBundle == null)
{
Debug.Log("Failed to load AssetBundle!");
yield break;
}
var assetLoadRequest = myLoadedAssetBundle.LoadAssetAsync<GameObject>("Title");
yield return assetLoadRequest;
GameObject prefab = assetLoadRequest.asset as GameObject;
Instantiate(prefab);
myLoadedAssetBundle.Unload(false);
以上代码在Android中不起作用,但在编辑器中可以正常工作。