I got my code to work correctly but I can’t seem to remove GUI.DrawTexture if on press on another GUI button that not on the previous or next button. How can I remove the texture or add a blank texture to the GUI.DrawTexture once I press the 3D Model Gui button?
#pragma strict
var images : Texture2D[];
var i : int = 0;
public var objectToHide:GameObject;
function OnGUI () {
GUI.DrawTexture(Rect(365,20,1500,900),images*);*
if (GUI.Button(new Rect(880,930,100,50),“PREVIOUS”))
{
if (i > 0)
i–;
GUI.DrawTexture(Rect(200,50,100,100), images*);*
print(i);
objectToHide.SetActive(false);
}
if (GUI.Button(new Rect(1000,930,100,50),“NEXT”))
{
if (i < images.Length - 1)
i++;
GUI.DrawTexture(Rect(200,50,100,100), images*);*
print(i);
objectToHide.SetActive(false);
}
if (GUI.Button(new Rect(1120,930,100,50),“3D MODEL”))
{
objectToHide.SetActive(true);
}
}