- Home /
GuiText Score On Mouse Click
Hello, Im trying to make a scoring system in two parts, one that is attached to a GUIText and another that is attached to an object to be clicked in order to add up points.
This is what I currently have on the GUIText
 var Counter : int = 0;
 
 function onGUI(){
     guiText.text = "Score: "+CountingCode.score;
 }
and this is what is on the object to be clicked to get points
CountingCode.js
 static var Counter : int = 0;
 
 function OnMouseDown(){
       Counter+=10;
 }
When I click the afformentioned object with these scripts active nothing happens. Can someone please show me what is wrong?
Answer by sumiguchi · May 10, 2012 at 09:53 PM
Put a Debug statement in OnMouseDown() - I'd guess that it isn't getting called at all.
Make sure that the object you are clicking on:
- has the script CountingCode.js attached to it (which I presume is the case based on your comment) 
- is a GUI Element or has an active collider attached to it. 
Hope it helps!
Your answer
 
 
             Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How to I make a Death Counter? 1 Answer
Cursor Locks/Hides but Will Not Reappear? 1 Answer
SIDE SCROLLING MOUSE CONROL HELP! 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                