万年素人からHackerへの道

万年素人がHackerになれるまで殴り書きするぜ。

  • ・資産運用おすすめ
    10万円は1000円くらい利益
    資産運用ブログ アセマネ
    • ・寄付お願いします
      YENTEN:YYzNPzdsZWqr5THWAdMrKDj7GT8ietDc2W
      BitZenny:ZfpUbVya8MWQkjjGJMjA7P9pPkqaLnwPWH
      c0ban:8KG95GXdEquNpPW8xJAJf7nn5kbimQ5wj1
      Skycoin:KMqcn7x8REwwzMHPi9fV9fbNwdofYAWKRo

    Web to Image Unity

    unity3d - Using new UI Image component to show a image on web in Unity 4.6 - Stack Overflow

    しかし、大きさによってエラーになるので動的にサイズをとるといい。

        IEnumerator SetFromWeb ()
        {
            WWW imageURLWWW = new WWW (myUrl);
            yield return imageURLWWW;
    
            if (imageURLWWW.texture != null)
            {
                //Construct a new Sprite
                Sprite sprite = new Sprite ();
                //Create a new sprite using the Texture2D from the url. 
                //Note that the 400 parameter is the width and height. 
                //Adjust accordingly
    
                sprite = Sprite.Create (imageURLWWW.texture, new Rect (0, 0, imageURLWWW.texture.width, imageURLWWW.texture.height), Vector2.zero);
    
                //Assign the sprite to the Image Component
                GetComponent<UnityEngine.UI.Image>().sprite = sprite;
            }
    
            yield return null;
        }