There are multiple things going on:
(Why are you setting score to 0 if score == 0? You could just leave
the else away.)
In DisplayScore
you are accessing the scoreText
field. That will throw a NullReferenceException if you haven't
set it in the inspector.
In ResetScore
you are getting the
GameManager
instance. The call to ResetQuestions
will throw a
NullReferenceException if your gameobject that contains the Score
script doesn't contain the GameManager
script too.
In Start
of the GameManager
you could get a NullReferenceException if you haven't set any question in the inspector.
You have an off by one error in your SetCurrentQuestion
. Basically if there are no questions you are getting a random number from 0 to 0. The only valid result is 0 in that situation. You are then accessing question with index 0. But there won't be one. (That would throw an IndexOutOfRangeException)
Any of your private [SerializeField] fields could throw a NullReferenceException if it hasn't been assigned in the inspector.
As you can see, many of your statements could result in a NullReferenceException. We won't be able to actually tell you where the issue is, because it could be in so many places. You are best off by debugging your code and checking where a variable you are trying to access is null.