Setting GUI textures

Hi all.

How do you define the texture or picture name in the editor? For example, If I have a texture named “Gun”, how can I say that when I press “A” I want the texture inside the OnGUI() function to be changed to “Gun” texture, when pressed “B” the texture is changed to “Rifle” etc…

I know how to do the array with multiple textures already assigned, and then swapping them, but that’s not what I need.

Thanks.

i dont know what you are exactly asking for but as per my understanding of the question hope this code helps

var Gun : Texture2D;
var Rifle : Texture2D;
private var Temp : Texture2D;

function Start () 
{
	Temp = Gun;
}


function OnGUI()
{
	GUI.Label(Rect(5,5,64,96),Temp);
	
	if(GUI.Button(Rect(20,100,30,20),"A"))
	Temp = Gun;
	if(GUI.Button(Rect(50,100,30,20),"B"))
	Temp = Rifle;	
}