private IsoUnity.Cell SearchCellInMap(Cell cell) { // Get map of scene IsoUnity.Map map = GameObject.Find("Map").GetComponent <IsoUnity.Map>(); // Search cell with same coords IsoUnity.Cell isoCell = null; foreach (IsoUnity.Cell c in map.Cells) { var coords = map.getCoords(c.gameObject); if (coords.x == cell.x && coords.y == cell.y) { isoCell = c; } } if (isoCell == null) { Debug.Log("The cell selected (coords x: " + cell.x + ", y: " + cell.y + ") doesn't exists in the current map!"); } return(isoCell); }