2D Array of GameObjects...

Hey Guys,
This should be really simple but I have no idea why its not working… I initialize a 2d array then try to create a gameobject and store it at each index, but it keeps giving the error “Object not set to an instance of an object” I have the gameobject set in the inspector, and same with the row height and column length… Please help,

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class MeteorSpawn : MonoBehaviour {

	public GameObject TestMeteor;
	public int ColumnLength;
	public int RowHeight;

	public GameObject [][] meteorArray;

	// Use this for initialization
	void Start () {


		for(int i = 0; i<ColumnLength; i++){


			for(int j=0;j<RowHeight; j++){


				meteorArray*[j] =	(GameObject)Instantiate(TestMeteor,new Vector3(i,j,0),Quaternion.identity) ;*
  •  	}*
    
  •  }*
    
  • }*

  • // Update is called once per frame*

  • void Update () {*

  • }*
    }

What you are trying to use is an array of arrays, not a two dimensional array. Here you can read about the difference: c# - Multidimensional Array [][] vs [,] - Stack Overflow

Here’s the fixed class:

using UnityEngine;
using System.Collections;

public class MeteorSpawn : MonoBehaviour {

public GameObject TestMeteor;
public int ColumnLength;
public int RowHeight;

public GameObject[,] meteorArray;

// Use this for initialization
void Start()
{
    meteorArray = new GameObject[ColumnLength,RowHeight];

    for (int i = 0; i < ColumnLength; i++)
    {

        for (int j = 0; j < RowHeight; j++)
        {

            meteorArray[i,j] = (GameObject)Instantiate(TestMeteor, new Vector3(i, j, 0), Quaternion.identity);

        }

    }

}

// Update is called once per frame
void Update()
{

}
}