I'm trying to instantiate an object once the countdown = 0. So what is wrong with my code? (it instnatiates after one collision, rather than two.)
var total : int = 2;
var firework : GameObject;
var celebrationMaker : GameObject;
var myLevel : String;
function OnCollisionEnter(theCollision : Collision) {
if(theCollision.gameObject.name == "Sphere") {
(total--);
print (total);
var instance : GameObject = Instantiate(firework, transform.position, transform.rotation);
if (total == 0);
Application.LoadLevel(myLevel);
}
}