//starts the timer to remove plant component void StartTimer() { //if it's not the end of the game if (!endGame) { //if we haven't started the spawn cycle yet if (!bStartSpawn) { //set a random respawn time between the times specified in the editor startSpawnTime = Random.Range(lowestSpawnTime, highestSpawnTime); bStartSpawn = true; } //start timer timer += Time.deltaTime; //if time has reached the limit if (timer > startSpawnTime) { //remove component, add a new one basePlant.RemoveComponent(); AddNewPlantComponent(); timer = 0f; bStartSpawn = false; } } }