- Home /
 
               Question by 
               jsonfan · Sep 04, 2015 at 03:24 AM · 
                c#unity 5gameobjectonmousedown  
              
 
              Only Allow One Click on GameObject?
I am making a game in C# where you can only click on the object one time and I need to check if it has been clicked on yet.
Using OnMouseDown registers every click no matter what. I'm unsure of how to only allow one click. Thank you.
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by getyour411 · Sep 04, 2015 at 03:23 AM
 Start()
 beenClicked = false;
 
 OnMouseDown()
 if (beenClicked)
 return;
 
 // do stuff
 beenClicked = true;
Answer by Vice_Versa · Sep 04, 2015 at 05:30 AM
use Input.MousePosition() http://docs.unity3d.com/ScriptReference/Input-mousePosition.html
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                