private string baseUrl = "http://10.0.102.45:8080/Assetbundle/";
private string basePath = "/sdcard/Assetbundle/";
public GameObject LoadFromLoacl (string bundleName, string objectName)
{
AssetBundle targetBundle = AssetBundle.LoadFromFile (basePath + bundleName);
if (targetBundle != null) {
GameObject asset = targetBundle.LoadAsset (objectName) as GameObject;
targetBundle.Unload (false);
return asset;
} else {
return null;
}
}
public GameObject LoadFromNet (string bundleName, string objectName)
{
WWW www = WWW.LoadFromCacheOrDownload (baseUrl + bundleName, 1);
AssetBundle targetBundle = www.assetBundle;
if (targetBundle != null) {
GameObject asset = targetBundle.LoadAsset (objectName) as GameObject;
targetBundle.Unload (false);
return asset;
} else {
return null;
}
}