Unity 3D script to Load next level if destroy all targets

Hi guys! I have one question. Can someone write script that will load next level when destroy all enemies. Its may look like

if(Destroy.GameObject){
Application.LoadLevel(“”);
}

Plz post some working version of this script.
Thx! :slight_smile:

This would be OK for a homework assignment. I wouldn’t use this code for a real game. In C#:

void Update()
{
   if ((GameObject.FindGameObjectsWithTag("Enemy")).Length == 0)
      Application.LoadLevel("the level");
}

On all enemies, assign their tag to “Enemy”.

This way will be very performance heavy, but it will work. And I typed this on my iPad so I couldn’t make a long script.

RazorCut
Thank you very much!