No need to change all the button Sprites in a loop

Since only the correct answer button ever has its sprite changed, it is easier and faster to just change that one before you load in a new Question and Answer set. Like this:

void GetNextQuestion()
{
	Image buttonImage = answerButtons[correctAnswerIndex].GetComponent<Image>();

	buttonImage.sprite = defaultAnswerSprite;	// Do this before we change the Question and Answer info
	// Change Question and Answer info here
	DisplayQuestion();
}	// GetNextQuestion()
4 Likes

Was thinking the exact same thing, scrolled down to check if anyone said this. :+1:

2 Likes

Privacy & Terms