This script will change the level after a specified Gameobject(s) are destroyed.
DIRECTIONS:
DIRECTIONS:
- Copy and paste the following script into a Javascript. Name script Enemy Count
- Tag the Gameobject(s) you want destroyed with the tag Enemy-you can change this but don't forget to change it it the script!
- Next drag the Enemy Count script onto the Player Gameobject.
- Next add the specified level ExampleGame-the name can be changed but don't forget to change it in the script-to the build settings. File -> Build settings -> Add current. This will add the current scene into the build settings.
- ENJOY!
Code:
//SCRIPT DEVELOPED BY ONEKNIFEGAMES DO NOT REMOVE!
#pragma strict
var level:int;
function Start () {
}
function Update () { print(GameObject.FindGameObjectsWithTag("Enemy").Length);
if(GameObject.FindGameObjectsWithTag("Enemy").Length==0) {Application.LoadLevel("ExampleGame");}
}
//SCRIPT DEVELOPED BY ONEKNIFEGAMES DO NOT REMOVE!