Problem Image GUI

Greetings,

I am making a GUI but when I try to create a Label which is a texture, then it doesn’t draw
the texture. The reason is that in theory mi image is NULL, so there’s no image linked to the var.

However, I have attached the image using the inspector, and I don’t undestand why this happen. Here is the code:

var Skin : GUISkin;

var img : Texture2D;

var speed : int;
var fuel : int;
var oxygen : int;
var gravity : int;
var coins : int;

function FillLabels(s : String, f : String)
{
	flabel=f;
	slabel=s;
}

function OnGUI()
{
	GUI.skin=Skin;
	
        GUI.Label ( Rect ( Screen.width/2, Screen.height/2, 65, 65 ), img );
}

http://unity3d.com/support/documentation/ScriptReference/Graphics.DrawTexture.html

I solved the problem. It was a mistake. I attached the image to the script object in the Project view, instead of the attached script of the object.

Thank you for your help :slight_smile: ,I have solved the problem finally. It was a mistake. I assigned the image to the script instead of the attached script of the object.

Thank you for your help