public void DrawTile(int matnumber) { foreach (Position pos in boardManager.possibleMovePositions) { string tileName = GetTileName(pos.x, pos.y); //Debug.Log(tileName); GameObject current_tile = GameObject.Find(tileName); MaterialControl current_matcontrol = current_tile.GetComponent <MaterialControl>(); Material[] mat = { current_matcontrol.material_list[matnumber] }; current_tile.GetComponent <MeshRenderer>().materials = mat; } piece_selected = GameObject.Find("0 6").GetComponent <Piece_new>(); piece_selected.Selected(); foreach (Move_new move in piece_selected.moves) { Debug.Log(move.secondPosition.Position.x); Debug.Log(move.secondPosition.Position.y); } }