So with my incredibly limited knowledge of JS I’ve written a simple script to show an image on the screen, but I’m having trouble with hiding it when pressing the button again. The code works to show the image below:
function Start () {
guiTexture.enabled = false;
}
function Update(){
if(Input.GetButton("Start")){
guiTexture.enabled = true;
}
}
I’ve tried several things but can’t seem to get my head around it, my latest failed attempt is:
#pragma strict
function Start () {
guiTexture.enabled = false;
}
function Update(){
if(Input.GetButton("Start") && guiTexture.enabled = false;){
guiTexture.enabled = true;
}
if(Input.GetButton("Start") && guiTexture.enabled = true;){
guiTexture.enabled = false;
}
}
I’m sure it’s fairly simple for someone more verse in javascript, any ideas?