if(object exists in scene)

I have a spawn script and i want waves to start ONLY if there are no other enemies present in the scene, but i can’t find a way to check if an enemy is instantiated. Here is my script:

using UnityEngine;
using System.Collections;

public class CrappyEnemySpawner : MonoBehaviour {
	public GameObject Enemy;
	public bool Enabled;
	public GameObject SpawnPoof;
	public float SpawnChanceIsOneIn;
	public float CurrentWave;
	public float EnemiesPerRound;
	public float WaveStartDelay;
	public float WaveDelay;
	public bool Wave;
	public GameObject SpawnedEnemy;

	// Use this for initialization
	void Start () {
		SpawnedEnemy = GameObject.FindGameObjectWithTag("Enemy");
		CurrentWave = 1;
		Wave = true;
	// Update is called once per frame
	void Update () {

		if (SpawnedEnemy.activeInHierarchy){
			Debug.Log ("No Enemies");

		if (Wave == false){
			WaveStartDelay += 1	;

		if (WaveStartDelay > WaveDelay){
			Wave = true;

		if (SpawnChanceIsOneIn<50 && Wave == true){
			SpawnChanceIsOneIn -= 3f;
		} else {
			SpawnChanceIsOneIn -= 0.1f;
	 	if(Random.Range(1,100)>SpawnChanceIsOneIn && Enabled==true && Wave == true){
				Instantiate(Enemy, transform.position, transform.rotation);

		if(SpawnChanceIsOneIn<EnemiesPerRound && Wave == true){
			Debug.Log ("Congrats! You've made it to wave" + CurrentWave);
			CurrentWave += 1f;
			WaveDelay *= 1f;
			Wave = false;
			EnemiesPerRound -= 1.5f;

Thanks in advance!

I do this by making all enemies children of the same GameObject. Then you can check childcount.

Another viable alternative is to add each enemy to a list and check the length of the list

It’s actually a very simple thing to do. In the script that is instantiating them (CrappyEnemySpawner in this case lol) you will want to keep track of all the spawned enemies by adding to directly to a list after they get instantiated. Like this:

// List definition. This will track the enemies that have been spawned.
private List<GameObject> m_enemies = new List<GameObject>();

// Place where the enemy gets instantiated and added to the list.
GameObject enemy = Instantiate(Enemy, transform.position, transform.rotation);

// When an enemy dies and you destroy it you will want to remove it from the list.

// Here is how you would check if there are no more enemies left.
If(m_enemies.Count <= 0)
   //All enemies have died, execute code in here.