Hi to all,
I made this script to hide an object when a button is pressed, but It doesn’t work… Where am I wrong?
public class NuvoleOnOff : MonoBehaviour {
public GameObject Nuvole;
public GUISkin buttonstyle ;
void OnGUI (){
GUI.skin = buttonstyle;
if(GUI.Button(new Rect(690,5,100,70),"")){
Nuvole.GetComponent<Renderer>().enabled = false;
}
else {
Nuvole.GetComponent<Renderer>().enabled = true;
}
}
}