Hi guys, I’m new to this board so hello
I’m make a simple quiz game. I’m using C#. I’d like to make a ‘question’ class that includes a few properties like ints and strings.
using UnityEngine;
using System.Collections;
public class Question {
public string question;
public string[] answer = new string[3];
public int correctAnswer;
}
But when I try to make an array of ‘questions’ like this -
Question[] myQuestion;
for(int i=0; i<5; i++){
myQuestion *= new Question();*
}
I get this nasty error…
"NullReferenceException: Object reference not set to an instance of an object
(wrapper stelemref) object:stelemref (object,intptr,object)"
Any ideas on how to create an array of custom class objects?