- Home /
Game Script for Mouse Click Scoring.
I'm trying to make this code to work. I want it to add points onto the GUI Text as the player uses the mouse to click the object that this script is attached to. Right now its not working.
I keep getting an error saying: "HitscoreScript.js(2,25): UCE0001: ';' expected. Insert a semicolon at the end." Do I have the code setup correctly? What am I missing? What coding do I have to have on the GUI Text object?
var buck : int = 1;
var ScoreBoard : GUIText (ScoreBoard);
function OnMouseOver () {
if (Input.GetMouseButtonDown(0))
{
ScoreBoard.text = ("Score: ") + buck;
}
}
function Update () {
}
Answer by Rydrako · Sep 19, 2011 at 02:54 AM
Change your Scoreboard into a transform variable and get rid of the:
(ScoreBoard)
part and say
ScoreBoard.guiText.text = "Score: " + buck;
this at least what I would do and works for me. Hope it helps!
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
mouse click on objects 1 Answer
How to add a script to a object in unity 1 Answer
WHY SAYS ME THAT IS AN ERROR? 1 Answer
picking up an object while in game mode 0 Answers