- Home /
 
               Question by 
               raupp · Feb 11, 2016 at 10:32 AM · 
                mousecoroutinewaitforsecondsmouseclickclick objects  
              
 
              How to click only one once?
I'm trying to use the OnMouseDown() method, but when i click the object that opens an interatcion menu, if the mouse is over any of the menu buttons, the button is automatically clicked.
Can I disable all mouse clicks for a while after it's been pressed?
I tried using WaitForSeconds (), but couldn't find a way to make it work.
               Comment
              
 
               
              make a bool true after the click. And check before click that if the bool is false only then execute the code.
 bool isAlreadyClicked = false;
 void On$$anonymous$$ouseDown(){
        if ( !isAlreadyClicked){
         // Do Something here 
         isAlreadyClicked = true;
    }
 }
Just use On$$anonymous$$ouseUp() insted. http://docs.unity3d.com/ScriptReference/$$anonymous$$onoBehaviour.On$$anonymous$$ouseUp.html
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                