//When the enemies health reaches 0 //Drop coins, and destroy the object public void Die() { //Randomly reward the player a number of coins from the //Min and Max ints int reward = Random.Range(minCoins, maxCoins); for (int i = 0; i < reward; i++) { //Make them coins Instantiate(coin, transform.position, transform.rotation); } List <GameObject> t = waveSpawnerRef.GetEnemies(); for (int i = 0; i < t.Count; i++) { if (gameObject.tag == "Enemy") { t.RemoveAt(i); break; } } //Destroy that baddie Destroy(gameObject); }