assetbundle 从远程读取.unity3d并在加载对应图片
public UITexture sprite;WWW www = new WWW("http://121.199.16.23/atlas.unity3d");
yield return www;
Texture2D txt2d = new Texture2D(4, 4, TextureFormat.DXT1, false);
txt2d = www.assetBundle.mainAsset as Texture2D;
sprite.mainTexture = txt2d; void OnGUI(){
if(GUI.Button(new Rect(5,35,100,25) , "Load GameObject")){
StartCoroutine(LoadGameObject());
}
}
private IEnumerator LoadGameObject(){
// AssetBundle 檔案路徑
string path = string.Format("file://{0}/../_AssetBunldes/{1}.assetBunldes" , Application.dataPath , "TestGameObject");
//載入 AssetBundle
WWW bundle = new WWW(path);
//等待載入完成
yield return bundle;
//實例化 GameObject 並等待實作完成
yield return Instantiate(bundle.assetBundle.mainAsset);
//卸載 AssetBundle
bundle.assetBundle.Unload(false);
}
不错 不错 不错{:soso__3922851084632044791_6:} 请问帅哥大神,如何从web服务器下载资源呢?我只能下载本地。 很不错 难得一见的好帖 说的非常好 很好哦 不错不错 好帖就是要顶
页:
[1]