- Home /
help loading level after destroying objects
hi im making a car game were the player car collides with an enemy car and destroys it. in level 1 it'll have 2 cars that can be destroyed. when there are no enemy cars remaining, i want to load a new level. how can i load new level after there arre no cars left.
Comment
Answer by Anxo · Jun 02, 2011 at 09:22 PM
var cars : int;
function OnCollisionEnter(other : Collider){
if(other.gameObject.CompareTag("othercar"))
{
car --;
if (car ==0)
{
Application.LoadLevel("LevelName");
}
}