public void addSaveData() { teamSaveData.Clear(); gMSaveData.Clear(); for (int i = 0; i < 9; i++) { Team Teamobject = GameObject.Find("Team" + i).GetComponent <Team>(); Teamobject.AddData(); SaveTeamData data = Teamobject.data; teamSaveData.Add(data); if (i == 8) { this.gameObject.GetComponent <GameManagment>().addData(); gMSaveData.Add(this.gameObject.GetComponent <GameManagment>().data); SaveTeams(); SaveGMData(); } } }