- Home /
 
 
               Question by 
               unity_LUbQ6QyiZDNLzQ · Mar 18, 2019 at 07:02 PM · 
                2dinputgamereturngetkeydown  
              
 
              How to play animation after pressing return 3 times ?
I understand this: if(Input.GetKeyDown(KeyCode.Return)), but how to make this works, but only after pressing return 3 times ? I want to make different animations play on different press in a 2dcollider
 if(Input.GetKeyDown(KeyCode.Return))
 {
 animator2.SetBool("PlayRun", true);
 }
 
              
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by dan_wipf · Mar 18, 2019 at 07:07 PM
make a counter:
 int myCounter = 0;
 
 if(Input.GetKeyDown(Keycode.Return)){
   myCounter++; //short for +1
   }
 if(myCounter == 3){
     //your Code + reset
     myCounter = 0;
     }
     
 
              Your answer