I’m looking at the code that was shown in the lecture and have compared it to my own and it looks exactly like what he has, yet i am still getting the error with the ExploreNeighbors function. Specifically it’s pointing to the if statement directly.
What i have is:
void ExploreNeighbors()
{
List<Node> neighbors = new List<Node>();
foreach(Vector2Int direction in directions)
{
Vector2Int neighborCoords = currentSearchNode.coordinates + direction;
if(grid.ContainsKey(neighborCoords))
{
neighbors.Add(grid[neighborCoords]);
//TODO remove after testing
grid[neighborCoords].isExplored = true;
grid[currentSearchNode.coordinates].isPath = true;
}
}
}
What am I missing?