I've written a script for an enemy that moves along tiles on a grid, which is a 3D array with the first dimension being horizontal position, second vertical position and 3rd properties of the space. I have not referenced any objects, yet when I run the script it causes an "Object reference not set to an instance of an object" error.
public bool my_turn;
public bool turn_setup;
public List<int> my_grid_pos;
public List<List<List<int>>> grid;
void Update () {
if(my_turn)
{
if (turn_setup)
{
grid[my_grid_pos[1]][my_grid_pos[0]][2] = 1;
}
}
}