The last button seems to be in the Hierarchy. This means that it is there. Maybe the box in which the buttons get displayed is too small. Try to make it larger.
Greetings, I was able to move the button, but now upon more playtesting, it’s something up with the QuestionSO script code.
I’ve followed each and every step, but now, no matter what answer is put in the correct answer Index, on playing it, the button gets deleted and can’t be clicked.
is this a glitch with the code or maybe Unity reading correctAnswerSprite incorrectly somewhere?
That’s a good question. Have you already tried to add Debug.Logs to your code to see what is going on during runtime? Maybe Unity assigns the “wrong” sprite.
And have you already compared your code to the Lecture Project Changes which can be found in the Resources of this lecture?
I added the Debug.Log to the method of DisplayAnswer else statement, and now changed defaultAnswerImage back to correctAnswerSprite and it’s working fine now.
Does that mean you fixed the issue? Or is there still a problem you’d like to solve?
NullReferenceException means that a reference (“link”) to an instance is missing. Double click on the error message to see to which line in your code it is referring. If you exposed a field in the Inspector, make sure that it’s not empty.
For the NullReferenceException, it’s just pointing to DisplayAnswer(-1) and the if (index == currentQuestion.GetCorrectAnswerIndex()) parts of the code, but no error there from what I see.
And so far as I’ve seen now in playtesting, original issue is fixed now.