I got partway through the Connecting the Timer section of the Quiz Master course when I encountered compiler errors that I cannot for the life of me understand why they are happening. So far I’ve followed along as best I could and made corrections whenever necessary to match what Greg was showing in the videos. But I seem to have missed something somewhere because now I’m getting these errors on the 3 lines of code that just got added right after a challenge.
Assets\Scripts\Quiz.cs(36,18): error CS1061: ‘Timer’ does not contain a definition for ‘loadNextQuestion’ and no accessible extension method ‘loadNextQuestion’ accepting a first argument of type ‘Timer’ could be found (are you missing a using directive or an assembly reference?)
Assets\Scripts\Quiz.cs(39,19): error CS1061: ‘Timer’ does not contain a definition for ‘loadNextQuestion’ and no accessible extension method ‘loadNextQuestion’ accepting a first argument of type ‘Timer’ could be found (are you missing a using directive or an assembly reference?)
Assets\Scripts\Quiz.cs(62,15): error CS1061: ‘Timer’ does not contain a definition for ‘CancelTimer’ and no accessible extension method ‘CancelTimer’ accepting a first argument of type ‘Timer’ could be found (are you missing a using directive or an assembly reference?)
The section of the Quiz script in question that provoked this:
void Update()
{
timerImage.fillAmount = timer.fillFraction;
if(timer.loadNextQuestion)
{
GetNextQuestion();
timer.loadNextQuestion = false;
}
}
public void OnAnswerSelected(int index)
{
Image buttonImage;
if(index == question.GetCorrectAnswerIndex())
{
questionText.text = "Correct!";
buttonImage = answerButtons[index].GetComponent<Image>();
buttonImage.sprite = correctAnswerSprite;
}
else
{
correctAnswerIndex = question.GetCorrectAnswerIndex();
string correctAnswer = question.GetAnswer(correctAnswerIndex);
questionText.text = "Sorry, the correct answer was;\n" + correctAnswer;
buttonImage = answerButtons[correctAnswerIndex].GetComponent<Image>();
buttonImage.sprite = correctAnswerSprite;
}
SetButtonState(false);
timer.CancelTimer();
}