Unity / C#: enemy spawning every round
This is my current code. I want the game to every round remove the current enemy that has been spawned and spawn a new one. It creates the instance of the enemy and then runs other subroutines and once that enemy is destroyed this sub routine is called again. is there a way to destroy the current enemy with this code. IEnumerator setupBattle(int round) { if (round != 0 ) { DestroyTheObject(enemyGo); } int randomIndex = Random.Range(0, enemyPrefabs.Length); GameObject enemyGo = Instantiate(enemyPrefabs[randomIndex], EnemySpawnSpot); EnemyUnit = new Enemies(randomIndex + 1, 2); PlayerUnit = new
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.