Hello everyone, I am using this code to open a door below by entering a code:
function Update () {
}var doorCode : String = “casa”;
var stringToEdit : String;
var buttonMessage : String = “Digite Código”;
function OnGUI(){
stringToEdit = GUI.TextField (Rect (20, 100, 70, 25), stringToEdit, 4);
if(stringToEdit == doorCode){
buttonMessage = “Abrir Bau”;
}else{
buttonMessage = “Digite Código”;
}
if(GUI.Button(Rect(95, 100, 120, 25), buttonMessage) && stringToEdit == doorCode){
transform.Rotate(-90,0,0);
}
}
I would like to add some element to the script to make the buttons appear when the player enters the room and disappear when the player leaves. thank you