private void CreateBots() { if (botsList != null) { if (botsList.Count != 0) { for (int i = 0; i < botsList.Count; i++) { GameObject.Destroy(botsList[i].gameObject); } } } botsList = new List <TrainController>(); for (int i = 0; i < populationSize; i++) { TrainController bot = ((GameObject)Instantiate(botPrefab, new Vector3(2, 1, 0), Quaternion.identity)).GetComponent <TrainController>(); bot.Init(nets[i]); botsList.Add(bot); } }