Prefab Destroy

Hello guy i am make FPS for android and i need really help so i have set up targets and you need to destroy them but how . how do i make number of object get destroyed be for you move on to next level can you help me thanks you :slight_smile:

and is there way to show how many are left like in gui text or any thing

If you want to destroy an object, do so like this.

GameObject myGameObject;


If you want to count how many have been destroyed, Iā€™d setup a global controller that every target has a reference to. When a target is hit, it would call something like targetHit() on the global controller script that would decrement a variable by one. The target would then proceed to destroy itself.


var cars : int;
var leveltoload : int;

function OnTriggerEnter (other : Collider)

	cars --;
	if(cars == 0)