how to make a list of gameobjects unity and make them move separatly code example
Example: how to make a list of gameobjects unity and make them move separatly
public List<GameObject> Enemies = new List<GameObject>(); public GameObject Enemy; public float TimeLimit; public float Timer; public float Speed; public int count; void Update () { Timer++; if (Timer >= TimeLimit) { Enemies.Add(Enemy); GameObject.Instantiate(Enemies[count], Enemy.transform.position, Quaternion.identity); count = count + 1; Timer = 0; } if (Enemies.Count == 5) { Enemies[2].transform.Translate(Vector3.up * Speed * Time.deltaTime); } }