I have this script attached to my player, and the object is Tagged correctly "DestructibleObject". But nothing happens the score never increases it always says Score : 0 when i collide with it.
Can someone take a loot at it see if i missed something, it's late so my brain shut off at 6pm.
static var score : float = 0;
var oneTime : boolean = false;
function Update () {
guiText.text = "Score : " + score;
}
function OnGUI()
{
GUI.Label(new Rect(10, 10, 60, 20), "Score: " + score);
}
function OnCollisionEnter ( collision : Collision){
if(!oneTime){
if (collision.gameObject.tag == "DestructibleObject"){
score += 100;
oneTime = true;
}
}
}
↧