Hi all, I have a game where i have a sphere collider set to “is trigger” and whenever the airplane i have hits it the score increases by 1. At least that is the intention, it always goes up at inconsistent rates, from 2 -7. I added in my code something that would destroy the collider a soon as the plane hit it, but it still didnt work, Here is my code (Javascript)
How do i fix it so that the score always goes up by 1 or my set value? Thanks!
#pragma strict
private var Score : int = 0;
var guiScore : GUIText;
function Start () {
guiScore.text = “Score: 0”;
}
function Update () {
}
function OnTriggerEnter(col : Collider){
if(col.collider.name == “Sphere”){
Destroy(col.gameObject);
Score += 1 ;
guiScore.text= "Score: " +Score;
print(“Hit!”);
}
}