//move the object to a space provided it is not full private void moveToSpace(int[] xzy) { if (!grid.getGameObjByCoords(xzy).GetComponent<GridCell>().isEmpty()) { return; } AStar pathFinder = new AStar(); pathFinder.findPath(grid.getGameObjByCoords(mycells[0]).GetComponent<GridCell>(), grid.getGameObjByCoords(xzy).GetComponent<GridCell>(), grid.cells); List<KeyValuePair<float,int>> dirs = cellsToDirs(pathFinder.cellsFromPath()); StartCoroutine(rotateAndMoveObject(dirs)); string s = ""; foreach(KeyValuePair<float,int> dir in dirs) { s += dir.Key + "," + dir.Value + " "; } Debug.Log(s); }