WWW类加载AssetBundle
IEnumerator LoadForWWW(){
	string fileUrl = "file://D:/Documents/Study/Assets/14/AssetBundle/ppp.assetbundle";
	
	using(WWW www = new WWW(fileUrl)){ //www资源用完自动释放
		yield return www;  //等待加载完成
		AssetBundle bundle = www.assetBundle; //通过assetBundle属性获取 
		Object player = bundle.LoadAsset ("Player");
		Instantiate (player);
		bundle.Unload (false);

	}
}

使用www来加载资源,如果加载本地的需要加上file:://协议表示本地

所有需要加载服务器上的资源时,用http://,https://等


首页 我的博客
粤ICP备17103704号