(Pseudo Code)
if(User Select Ans A)
{
SceneManager.LoadScene(“Questions 2”)
points ++;
}
else()
{
SceneManager.LoadScene(“Questions 2”)
}
im trying to make a quiz game that has a questions and 4 buttons per question.
but i dont know how to do it in one scene so i decided to use multiple Scenes for the question, this is my first time using Unity3d and im a newbee programmer. Please Help me Suggestions is much appriciated thank you guys,
In your scene your going to want an object with a script attached. In that script you will want a method that will be called by each button when its clicked. Since we’ll be loading a new scene, you’ll also want a static class for tracking the points.
public static class Globals
{
public static in Points = 0;
}
public class QuestionController : MonoBehavior
{
public void CorrectAnswerClicked()
{
Globals.Points++;
SceneManager.LoadScene("Questions 2");
}
public void IncorrectAnswerClicked()
{
SceneManager.LoadScene("Questions 2");
}
}
Then, in your scene, set the callback function for the buttons to map to the appropriate method in the above script.
im trying to digest the things that you told me, thank you very much for answering it :D. i havent sleep for almost 24 hrs now, so ill get back into this… thank you again sir!