void Update() { transform.Translate(Vector3.down * formationSpeed * Time.deltaTime); // speed of enemy ship if (EnemyWaveDead() && spawnUpgrade == true) // if entire wave killed { GameObject upgrade = Instantiate(upgradePrefab, transform.position, Quaternion.identity) as GameObject; // create upgrade pointSystem.DoubleScore(); // double score since entire wave was killed spawnUpgrade = false; // assign bool which creates upgrade back to false. } }