I’m doing the Unity 2D course and have been slowly working through the Quiz Master project. I’ve found it harder to get my head around the content of this project than the first two, and feel like things that could use a little extra explanation instead are just introduced and ignored.
Case in point, from lecture 58/59:
TextMeshProUGUI buttonText = answerButtons[i].GetComponentInChildren();
buttonText.text = question.GetAnswer(i);
During the lecture we are told that we are going to introduce a temporary variable, but this is not a term that has come up before in the course and it doesn’t get an explanation. My vague understanding is that in order to link to complicated pieces of code, you make one simpler piece of code that in itself doesn’t belong in the Inspector or Hierarchy, but is a link to something that is. Is that about right?
I’m curious if this code could have worked without using the temporary variable - i.e. just making it so that the text component in the answerButtons game object = question.GetAnswer(i).