Unity 4.6: How to access Image class? Let's say to change sprite with the code.

Well these features are pretty new I would say this is just a bug waiting to be fixed. But it’s weird that Image class is shown as “Image (script)”. And when in code there is no class Image showing up or maybe I am missing something, maybe there is another way to access this class.


The puzzle I’m trying to solve is: what’s the code to access “source Image”?

Ok I was able to quickly answer my own question.

I needed to add this… obviously

using UnityEngine.UI;

For others that stumble upon this (and still dont get it like me…), here is a little more meat.

var theImage:UnityEngine.UI.Image; 
var theSprite:Sprite; //The image you want to drag in the inspector

theImage.sprite = theSprite; //Setting the new image

Hopefully I didn’t complicate things.