Hey people,
I’m making a application that gets data from a xml feed, so I’m trying to create a raw image at runtime, but it looks really odd. not sure what’s happening.
I’m trying to load this image:
but when it gets to my application and I create my raw image it comes back like this:
does anyone know what’s going on?
The code I’m using:
In start:
StartCoroutine (Test (feedItems [0].images [0]));
which currently is just calling this link: http://i0.wp.com/theultralinx.com/wp-content/uploads/2014/08/workspace-keyboard-mouse-coffee.jpg?resize=620%2C465
IEnumerator Test (string url) {
WWW www = new WWW(url);
yield return www;
Debug.Log ("Width: " + www.texture.width + " || Height: " + www.texture.height);
int width = www.texture.width / scaleRatio;
int height = www.texture.height / scaleRatio;
GameObject newImage = new GameObject ("Tester Image");
RectTransform rectT = newImage.AddComponent <RectTransform> ();
newImage.AddComponent <CanvasRenderer> ();
RawImage rawImg = newImage.AddComponent <RawImage> ();
rectT.SetParent (mainCanvas.transform);
rectT.sizeDelta = new Vector2 (width, height);
rectT.localPosition = new Vector3 (0, 0, 0);
rawImg.texture = www.texture;
}