Change 2D Images on GUI when clicking objects.

I an FPS player that walks around a room and can click on different objects (cubes, spheres, cylinders, etc.). Every time the player clicks an object, a GUI is displayed showing different pictures associated with that certain object. Every object has different images associated with it. The GUI is set up so each image is the same size so the format of the GUI is the exact same for each object, just with different pictures. Is there a way to change the images during runtime? Right now every object has different images associated with it, but whenever I click them the GUI displays the same images for each object. All help is greatly appreciated. Here is what my code looks like:

public var testChar:Texture2D;

function Update () 
{
	
}

//bring up GUI if player clicks on an object (handled in ScanObject.js)
function OnGUI()
{
	if(ScanObject.bringUpLibrary)
	{	
		//display character info
		DrawTestChar();
		//stop displaying GUI if user clicks exit button

		if(GUI.Button (Rect(10,Screen.height-110,150,100), "Exit Library"))
		{
			print("Exit Button pressed!");

			ScanObject.bringUpLibrary = false;
		}
	}
}

//draws testChar
function DrawCharacterInfo()
{
	print ("Drawing TestChar.");
	GUI.DrawTexture(Rect(200, 10, 200, 200), testChar2);
}

Hi, welcome to the forum!

You will probably want to use an array to do this. You can declare an array of textures in your script like this:-

var texArray: Texture2D[];

You can set the number of elements in the array and drag textures into it from the inspector. Then, in the script, you can choose whichever texture is appropriate:-

function OnGUI() {
    var currentTex = texArray[3];
    GUI.DrawTexture(texRect, currentTex);
}