Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
public List<GameObject> enemyFormations = new List<GameObject>(0);
void Update ()
{
// If we have no enemies on the screen, get a random prefab from our list and spawn it then ensure it is active
if (GameObject.FindGameObjectsWithTag("Enemy").Length <= 0)
{
GameObject prefab = enemyFormations[Random.Range(0, enemyFormations.Count)];
GameObject formation = Instantiate(prefab);
formation.SetActive(true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment