Writes that the reference to the object does not indicate an instance of the object, although all values are assigned. I have already tried everything and I have no idea how to fix this error.
public enum blocks
{
air,
ground
}
static blocks[][] layer1;
static blocks[][] layer2;
static blocks[][] layer3;
public static blocks[][][] layers;
public static void Start()
{
layer1 = new blocks[7000][];
layer2 = new blocks[7000][];
layer3 = new blocks[7000][];
for (int y = 0; y < 7000; y++)
{
layer1[y] = new blocks[7000];
layer2[y] = new blocks[7000];
layer3[y] = new blocks[7000];
}
for (int x = 0; x < 7000; x++)
for (int y = 0; y < 7000; y++)
{
layer1[x][y] = blocks.air;
layer2[x][y] = blocks.air;
layer3[x][y] = blocks.air;
}
layers = new blocks[3][][];
layers[0] = layer1;
layers[1] = layer2;
layers[2] = layer3;
Player player = new Player();
Console.WriteLine(layers[1][1][1]); //output: air
try
{
GameMain.text.text = layer1[1][1].ToString(); //error happens here
}
catch (SystemException ex)
{
Console.WriteLine(ex.ToString());
}