Hi,
I have a True or False game where it adds a score if a button that is the right answer is pressed, then a animation plays and the scene reloads with a new question, a score is also given right when the button is pressed. The problem is, that people can keep smashing the right answer button repeatedly for extra score as whenever they press it they get 1 added to their score. Is there a way to prevent the button to be pressed more then once before the scene reloads? I’m on Android.
I’m using sumScore & MaterialUI.
Here’s my code with the score parts in it:
IEnumerator TransitionToNextQuestion()
{
unansweredQuestions.Remove(currentQuestion);
yield return new WaitForSeconds(timeBetweenQuestions);
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
SumScore.SaveHighScore();
}
public void UserSelectFact()
{
if (currentQuestion.isTrue)
{
SumScore.Add(1);
SumScore.SaveHighScore();
}
if (!(currentQuestion.isTrue))
{
SumScore.SaveHighScore();
SceneManager.LoadScene("Lose");
}
animator.SetTrigger("True");
StartCoroutine(TransitionToNextQuestion());
}
public void UserSelectFiction()
{
if (currentQuestion.isTrue)
{
SumScore.SaveHighScore();
SceneManager.LoadScene("Lose");
}
if (!(currentQuestion.isTrue))
{
SumScore.Add(1);
SumScore.SaveHighScore();
}
animator.SetTrigger("False");
StartCoroutine(TransitionToNextQuestion());
}