Draw Call Batching
for(int i =0; i < 500; i++){ GameObject cube; cube = GameObject.Instantiate(prefab) as GameObject;}
for(int i =0; i < 500; i++){ GameObject cube; cube = GameObject.Instantiate(prefab) as GameObject; if(i /100 == 0) { cube.transform.localScale = new Vector3(2 + i,2 + i, 2 + i); }}
MipMap
IEnumerator DownloadAndCache (){ // Wait for the Caching system to be readywhile (!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 cacheusing(WWW www = WWW.LoadFromCacheOrDownload (BundleURL, version)){ yieldreturn www;//WWW是第1部分 if (www.error !=null)throw new Exception("WWW download had an error:" + www.error); AssetBundle bundle= www.assetBundle;//AssetBundle是第2部分if (AssetName =="")Instantiate(bundle.mainAsset);//实例化是第3部分else Instantiate(bundle.Load(AssetName));// Unload the AssetBundles compressed contents to conserve memory bundle.Unload(false); } // memory is freed from the web stream (www.Dispose() gets called implicitly) }}
WWW www = WWW.LoadFromCacheOrDownload (BundleURL, version)
AssetBundle bundle = www.assetBundle;
Instantiate(bundle.mainAsset);
using(WWW www = WWW.LoadFromCacheOrDownload (BundleURL, version)){}
//删除AssetBundlebundle.Unload(false);
文章来源: (转)Unity 如何减少DrawCall