【问题标题】:How to download file into unity from remote server如何从远程服务器将文件下载到统一中
【发布时间】:2015-09-29 18:33:06
【问题描述】:

我想在我的场景中添加一个带有脚本组件的空游戏对象。我想要做的是当用户与这个游戏对象发生冲突时,会从远程服务器下载一个 img 文件并显示......

我对 WWW 统一类了解一点,但我不是 100% 如何实现它来做我想做的事,有什么代码建议吗?

【问题讨论】:

    标签: unity3d


    【解决方案1】:

    试试这个。

    IEnumerator LoadPictureAnimate (string url) {
        WWW www = new WWW(url);
        yield return www;
    
        Texture2D texture2D = www.texture;
    
        Rect textureRect = new Rect(0, 0, texture2D.width, texture2D.height);
        GetComponent<SpriteRenderer>().sprite = Sprite.Create (texture2D, textureRect, new Vector2(0.5f, 0.5f));
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-05-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-21
      • 2016-11-18
      • 1970-01-01
      相关资源
      最近更新 更多