I’ve got a script for a button that adds a point every time I press it:
var AcceptInput : boolean = true;
private var score : int = 0;
var guiScore : GUIText;
function Start () {
guiScore.text = "Score: 0)";
}
funtion OnMouseDown () {
if(AcceptInput)
{
AcceptInput = false;
}
score += 1;
guiScore.text = "Score: " + score;
}
function OnMouseUp () {
AcceptInput = true;
}
I have 4 buttons that I can press to add a score on. But everytime I press the other button(which has the same script), the score starts again from 0 again. Do you guys have any ideas? Any help would be much appreciated. Thank You!