UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


descriptionEnemy Count EmptyEnemy Count

more_horiz
This script will change the level after a specified Gameobject(s) are destroyed.

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!

descriptionEnemy Count EmptyRe: Enemy Count

more_horiz
Great share OneKnife!
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply