Hi, I am asking quite a basic question. I have the javascript version running but not for c#
public class XXX : MonoBehaviour {
int cols =4, rows = 4;
Card[][] aCards;
void Start () {
aCards = new Card[rows][];
for(int i = 0; i < rows; i++){
for(int j = 0; j < cols; j++){
aGrid*[j] = new Card(); //<-------- error points to here*
-
}*
-
}*
- }*
}
public class Card{
…
…
}
When running the above code, I encounter the following error message. "NullReferenceException: Object reference not set to an instance of an object
(wrapper stelemref) object:stelemref (object,intptr,object)"
I can use an array list but i’m trying to understand whats wrong with this basic code.
My purpose is simply to assign a new class for every object in the 2D array. Any advice? Thank you.