using System.Collections.Generic; using UnityEngine; public class InteractableItem { // Properties and methods for interactable items like rocks and trees } public class GridSpace { public Crop Crop { get; set; } public GameItem GameItem { get; set; } public InteractableItem InteractableItem { get; set; } } public class GridManager : MonoBehaviour { public int tileSize = 32; private readonly Dictionary grids = new(); public static GridManager Instance { get; private set; } private void Awake() { if (Instance == null) Instance = this; else Destroy(gameObject); } public void CreateGridForMap(string mapName, Vector2Int gridSize) { grids[mapName] = new GridSpace[gridSize.x, gridSize.y]; } public GridSpace[,] GetGridForMap(Map map) { if (grids.TryGetValue(map.sceneName, out var grid)) return grid; Debug.LogError($"No grid found for map {map.sceneName}"); // create a new grid with default size CreateGridForMap(map.sceneName, map.gridSize); return grids[map.sceneName]; } // Update your other methods to take a mapName parameter and operate on the correct grid }