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);
}