Pathfinder.cs:-
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Pathfinding : MonoBehaviour
{
Dictionary<Vector2Int, Waypoint> grid = new Dictionary<Vector2Int, Waypoint>();
// Start is called before the first frame update
void Start()
{
LoadBlocks();
}
private void LoadBlocks()
{
var waypoints = FindObjectOfType<Waypoint>();
foreach (Waypoint waypoint in waypoints) // error in "waypoints"
{
var gridPos = waypoint.GetGridPos();
if (grid.ContainsKey(gridPos))
{
Debug.LogWarning("Overlapping Blocks");
}
else
{
grid.Add(gridPos , waypoint);
}
print("Loaded" + grid.Count + "Blocks");
}
}
}
The error says:-