unity3d 如何从网络加载obj模型并显示
我是u3d菜鸟,请问unity3d 如何从网络加载obj模型并显示请看http://www.u3dchina.com/forum.php?mod=viewthread&tid=656&extra=page%3D2%26filter%3Dsortid%26sortid%3D14%26sortid%3D14 站长推荐的新人帖 本帖最后由 scylove1989 于 2013-10-21 09:52 编辑
使用服务器的url,代码如下
public class DownLoad3 : MonoBehaviour {
public string url = "http://222.200.98.241:1082/"+"CubeTest.unity3d";
public int version = 1;
// Use this for initialization
void Start () {
string url2 = "file://"+Application.dataPath+"/CubeTest.unity3d";
StartCoroutine(LoadBundle(url));
}
// Update is called once per frame
void Update () {
}
public IEnumerator LoadBundle(string name){
using(WWW www = WWW.LoadFromCacheOrDownload(name, version)){
yield return www;
AssetBundle assetBundle = www.assetBundle;
GameObject gameObject = assetBundle.mainAsset as GameObject;
Instantiate(gameObject );
assetBundle.Unload(false);
}
}
}
使用url2就没有问题,但是使用url出现NullReferenceException异常,请问什么问题啊? 顶顶多好 真心顶 难得一见的好帖 很好哦 LZ真是人才 楼主是超人 好帖就是要顶
页:
[1]