RawImage bug?

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;

    }

bump

Hi, does this work properly if you just www load he image and set it without using coroutines?

Hi Tim, Thanks. I’ll give it a go, but don’t you need a coroutine to load something with www?

Could you also paste what your inspector looks like for the “Tester Image” object? I want to take a look at the recttransform settings as maybe they are incorrect.

Also what is scaleRatio set to? could this be your issue.

Hey Phil,

Sure; Here’s the inspector:

also, it doesn’t do it for every image. Some of them are fine, then some bug out like the one I showed above.

Hmm i’m not seeing anything wrong here (other then the layer not being UI but that shouldnt matter). Could you submit a but that we can repo it on?

uh sure I guess, Also I was using the Unity5 beta, would that be a issue at all?

Thats possibly an issue, that beta isn’t as up to date as the 4.6 beta.

ahhh sure, I’ll try it out on 4.6 before I send a bug report.

Thanks Phil.