Hi I'm new to Unity, and have very limite programming skills. I want to make a question window, in the window it will have one question, the question will have four different answers. If the use select the wrong answer, "Try angain" will appear; if the use select the right answer, "Well done" will appear, and a close button will show up.
Can anyone give me some ideas? Thanks very much
===========================================
EDIT: Hi Bravini thank you very much
Sorry,I only can understand very simple code, so I tried to modified your code, but the last part not working, could you point out what's wrong? Thanks very much
var textToShow1: String;
var textToShow2: String;
var textToShow3: String;
var textToShow4: String;
function OnGUI () {
GUI.Label (Rect (20, 10, 500, 30), "-------------Q1?-------------------");
GUI.Label (Rect (120, 40, 500, 30), textToShow1);
GUI.Label (Rect (120, 70, 500, 30), textToShow2);
GUI.Label (Rect (120, 100, 500, 30), textToShow3);
GUI.Label (Rect (120, 130, 500, 30), textToShow4);
if(GUI.Button(Rect(20,40,80,20),"A1")) {
textToShow1="Try Again";
}
if(GUI.Button(Rect(20,70,80,20),"A2")) {
textToShow2="Try Again";
}
if(GUI.Button(Rect(20,100,80,20),"A3")) {
textToShow3="Try Again";
}
if (GUI.Button(Rect(20,130,80,20),"A4")){
textToShow4 ="Well done!";
if(GUI.Button(Rect(20,160,80,20),"close")){
Application.LoadLevel (1);
}
}
}
=======================================================
EDIT: I've fixed the problem. Thanks! At least I've learned something =)
var isQuestionaryOn = false;
function OnGUI(){
if (GUI.Button(Rect(20,130,80,20),"A4")){
isQuestionaryOn=true;
textToShow4 ="Well done!";
}
if (isQuestionaryOn){
if(GUI.Button(Rect(20,160,80,20),"Back")){
Application.LoadLevel(1);
}
}
}