How to make double buttons?

What i want to do is to script my char in a way that when the user press W and then W again the the char changes animation.I know how to change the animations...but how to do the double tap button. (W+W immidiately)

Sounds like you want a 'double-click' on a key, right? Probably several ways to do it. I'd try something like this:

private var lastTapTime = 0;
var tapSpeed = .5; // in seconds, bigger numbers allow more time to detect double-tap

function Update()
{
  if (Input.GetKeyDown ("w"))
  {
    if ((Time.time - lastTapTime) < tapSpeed)
    {
      changeAnimation();
    }
    lastTapTime = Time.time;
  }
}

Hi there i found a way but im not sure if its what you are looking for. This simple Java script that i created basically allows you to play to two different animation with the same button:

 function Update (){

if(Input.GetKeyDown(KeyCode.O) && Input.GetKeyDown(KeyCode.O )) {

 animation.Play("Jump10");

}
else if (Input.GetKey(KeyCode.O)){

animation.Play("Jump11");
  }
  }

when you hold down the O Key the Following animation will play Jump 10

and if you press it once it will play Jump 11 :) hope this helps :)

http://aidtech-game.com/double-tap-button-unity3d/#.VOPjffmUd8E