#Help interpreting what I'm seeing in the Watch window of the debugger...
1 messages · Page 1 of 1 (latest)
This cell is at the eastern edge of the map, so neighborEast never had anything assigned to it. So why do the other three say "null" and neighborEast says null??
I'm asking because elsewhere I'm testing neighbors for have they been populated and having issues...
Here is where I'm checking each cell for valid neighbors on startup...
{
thisRow = cell.row;
thisColumn = cell.column;
cell.neighborNorth = GridAccessor(thisRow + 1, thisColumn);
cell.neighborSouth = GridAccessor(thisRow - 1, thisColumn);
cell.neighborWest = GridAccessor(thisRow, thisColumn - 1);
cell.neighborEast = GridAccessor(thisRow, thisColumn + 1);
}```
And then the GridAccessor method is here:
{
if (row > rows - 1 || row < 0)
{
return null;
}
if (column > columns - 1 || column < 0)
{
return null;
}
Cell cell = grid[row, column];
return cell;
}```
Hello! I'm not sure exactly about what is happening, but what appears when you click on the arrow to show some of the "null" object information?
I can see the properties of the various cells (a custom class) that are assigned to each location in the grid[,] array.
Is there a chance the cell is actually out of bounds? Maybe the code says columns and rows is something, but you changed it within unity?