Accessing a 'Raw Image' component in the new UI (Beta 4.6)

I’m really liking the beta UI system, but I’ve just run into an issue. I want to swap out a texture at runtime (making a thumbnail of a screenshot before uploading to the a server), and RawImage appears to be the way to do that. Only trouble is, I’m not sure how to access that component by script. Using ‘RawImage’ comes up red when I try it.

I feel silly not having figured this out, but is it even exposed? If the component name isn’t ‘RawImage’, what is it?

Ok, solved my problem courtesy of

The issue is that RawImage isn’t part of the standard UnityEngine namespace, it’s part of UnityEngine.UI. After adding using UnityEngine.UI; to my script, I now have access to it.

For those who are scripting in Javascript, remember that you have to use “import” instead of “using”. So the correct manner to do it in Javascript would be :

import UnityEnging.UI;