Hi there,
I’ve got the following script
#pragma strict
var stringToEdit : String = "Type Code Here";
function OnGUI(){
stringToEdit = GUI.TextField (Rect (10, 10, 200, 20), stringToEdit, 25);;
if (GUI.Button (Rect(Screen.width/2,Screen.height/2,80,20), "Submit")){
if(stringToEdit == "LCD TV"){
Application.LoadLevel ("TVscene");
}
if(stringToEdit == "Camera"){
Application.LoadLevel ("Camerascene");
}
}
}
Which works great. However, if the user types in something in the textfield that isn’t specified in the code, I want some sort of error message to come up (i.e. “Error: Invalid Keyword”).
Could I achieve this with an else statement perhaps?
Anyone have any ideas?
Thanks