private IEnumerator LoadTeams() { mainController.AllTeams = new List <TeamData>(); string[] files = Directory.GetFiles(CombinePaths(userFolder, "Teams")); totalTeams = files.Length; foreach (string file in files) { TeamAttributes data = LoadFile <TeamAttributes>(file); TeamData team = ScriptableObject.CreateInstance <TeamData>(); team.Attributes = data; team.Initialize(true); if (team.IsUserControlled) { mainController.UserTeam = team; } mainController.AllTeams.Add(team); teamsLoaded++; } yield return(null); }