Hey, I want a GUI Texture to enable and disable when I press the B Key. Is this possible?
Try this
var guiTexture : Texture2D; // The GUI texture to use
private var z : int;
private var guiTrue : boolean;
function Update () {
if (Input.GetKeyDown ("b")){
z = (z % 2) + 1;
if(z == 1){
guiTrue=true;
}else{
guiTrue=false;
print(z + " False");
}
}
}
function OnGUI()
{
if(guiTrue){
GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), guiTexture);
print(z + " True");
}
}