Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink
Share
Go down
avatar
{SUPER MEMBER}-LV.4
{SUPER MEMBER}-LV.4
Posts : 64
Points : 1857
Rep : 3
Join date : 2013-12-21
Age : 15
Location : USA
View user profilehttp://oneknifegames.weebly.com/

Enemy Count

on Fri Jul 03, 2015 11:49 am
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!
avatar
Admin
Admin
Posts : 608
Points : 3169
Rep : 406
Join date : 2013-12-11
Age : 21
View user profilehttps://www.youtube.com/user/misterninjaboy

Re: Enemy Count

on Sat Jul 04, 2015 1:36 pm
Great share OneKnife!
Back to top
Permissions in this forum:
You cannot reply to topics in this forum