I’ve been getting this error: NullReferenceException: Object reference not set to an instance of an object
ChoiceButton.Start () (at Assets/ChoiceButton.cs:20)
and I have no clue what to do now. I’ve looked at other posts like this one but can’t figure it out.
public class ChoiceButton : MonoBehaviour {
public Button button;
public Text choiceText;
private Choice choice;
private ChoiceList choiceList;
//[SerializeField] public bool currentBool;
// Use this for initialization
void Start () {
button.onClick.AddListener(HandleClick);
}
public void SetUp(Choice currentChoice, ChoiceList currentChoiceList)
{
choice = currentChoice;
choiceText.text = choice.choiceName;
choiceList = currentChoiceList;
}
/*public void LoadStartScene()
{
SceneManager.LoadScene(0);
}*/
public void HandleClick()
{
choiceList.QuizButtonFunction(choice);
}
}
Can anyone help? I’d really appreciate it, thanks.