U3D www 下载

//下载AssetBudles资源
string url = Application.dataPath + "/Resources/" + name + ".AssetBudles";
WWW www = new WWW(url);
//可以直接转化u3d使用类型
Sprite temp = www.assetBundle.LoadAsset<T>(name); //where T : Object; --> UnityEngine.Object


//下载图片资源
string url = Application.dataPath + "/Resources/" + name + ".png";
WWW www = new WWW(url);
Texture2D tex = www.texture;
Sprite temp = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0, 0));

猜你喜欢

转载自blog.csdn.net/u014236515/article/details/80004522