pls help!i’m trying to create a quiz game and i have modified a script to have a background window and a question would come up each time the user presses next question but my challenge now is the previous questions (in form of labels)refuse to disappear as the next question comes up i.e they are all one the same window which i dont want. i want the previous questions to disappear as the user presses the “next button”.
Pls any hlp wud b greatly appreciated. you can modify and even suggest new codes that i can use. tanx in advance.
This is my code
#pragma strict
var gameMessageFont : Font;
var isBoxShowing : boolean = false;
var isBox2Showing : boolean = false;
var isBox3Showing : boolean = false;
function OnGUI() {
GUI.skin.font = gameMessageFont;
GUI.Box(Rect(0, 0, 850, 290), "Exam");
if (!isBoxShowing && GUI.Button(Rect(360, 250, 150, 30), "Next Question")) {
isBox2Showing = true;
}
if(isBox2Showing) {
GUI.Label(Rect(0, 0, 850, 290), "Question 2");
if (!isBoxShowing && isBox2Showing && GUI.Button(Rect(160, 250, 150, 30), "To Question 3")) {
isBox3Showing = true;
}
}
if(isBox3Showing) {
GUI.Label(Rect(100, 0, 850, 290), “Question 3”);
if (!isBoxShowing && isBox2Showing && isBox3Showing && GUI.Button(Rect(560, 250, 150, 30), “To Question 4”)) {
}
}
}