public void ExitLoad(int index) { ExitData data = SavingSystem.ExitGameLoad(); string Tile = "Tiles"; if (PlayerPrefs.GetInt("Theme") == 0 || PlayerPrefs.GetInt("FirstTime") == 1) { foreach (Transform tile in PlayGrid) { Destroy(tile.gameObject); } } else if (PlayerPrefs.GetInt("Theme") == 1) { foreach (Transform tile in PlayGrid) { Destroy(tile.gameObject); } } for (i = 0; i < data.exitX.Count; i++) { x = data.exitX[index]; y = data.exitY[index]; Grid[x, y] = (GameObject)Instantiate(Resources.Load(Tile), new Vector2(data.exitX[index] * 1.1f, data.exitY[index] * 1.1f), Quaternion.identity); if (PlayerPrefs.GetInt("Theme") == 0 || PlayerPrefs.GetInt("FirstTime") == 1) { Grid[x, y].transform.SetParent(PlayGrid); } else if (PlayerPrefs.GetInt("Theme") == 1) { Grid[x, y].transform.SetParent(PlayGrid); } Grid[x, y].GetComponent <Tiles>().Number = data.exitTileNumber[index]; index++; } theScore = data.exitScore; }