

PlayerScore += currentRoundData.pointsAddedForCorrectAnswer // If the AnswerButton that was clicked was the correct answer, add points

public void AnswerButtonClicked(bool isCorrect) While (answerButtonGameObjects.Count > 0) // Return all spawned AnswerButtons to the object poolĪnswerButtonObjectPool.ReturnObject(answerButtonGameObjects) Īnd Answer Button Clicked and also to show the result if it was correct and wrong.

Quit game button unity update#
QuestionText.text = questionData.questionText // Update questionText with the correct textįor Questions->Button for (int i = 0 i () ĪnswerButton.SetUp(questionData.answers) // Pass the AnswerData to the AnswerButton so the AnswerButton knows what text to display and whether it is the correct answer QuestionData questionData = questionPool // Get the QuestionData for the current question QuestionChosen = true // Set questionChosen to true to end the while loop QuestionIndex = random // Set the questionIndex to the number QuestionIndexesChosen.Add(random) // Add the number to the list If (!questionIndexesChosen.Contains(random)) // If the new list doesn't contain the number Int random = Random.Range(0, questionPool.Length) // Choose a random number between 0 and the questionPool length While (questionChosen != true) // While question chosen does not equal true I'm trying to display all the incorrect/wrong answers of the game how can I do it? Here is the code.įor Showing Questions void ShowQuestion() I made a Quiz Game Multiple Choice by following the Official Tutorial in Unity on making a Quiz Game.
