Attack animation

Hello i want to know is how can i make that my axe is swinging.
first is that i already animated the axe.
but how can i do that in game.

i make this java script. but i dont know its right its not giving errors.

// Use this for initialization
function Start () {
}

// Update is called once per frame
function Update () {
    {
    // Links muis klik
    if(Input.GetMouseButtonDown(0))
            Debug.Log("Pressed Left Click.");
    animation.Play("Attack", PlayMode.StopAll);
    }
   
    {
    // Rechts muis klik
    if(Input.GetMouseButtonDown(1))
            Debug.Log("Pressed Right Click.");
    animation.Play("ZoomIn", PlayMode.StopAll);
    }
   
    {
    if(Input.GetKeyDown("w"))
    animation.Play("Walk", PlayMode.StopAll);
    }
   
    {
    if(Input.GetKeyDown("shift") && ("w"))
    animation.Play("Run", PlayMode.StopAll);
    }
   
    {
    if(Input.GetKeyDown("c"))
    animation.Play("Crouch", PlayMode.StopAll);
    }
  
     {
    if(Input.GetKeyDown("e"))
    animation.Play("Pickup", PlayMode.StopAll);
    }
   
    {
    if(Input.GetKeyDown("d"))
    animation.Play("WalkRight", PlayMode.StopAll);
    }
   
    {
    if(Input.GetKeyDown("a"))
    animation.Play("walkLeft", PlayMode.StopAll);
    }
   
    {
    if(Input.GetKeyDown("r"))
    animation.Play("Reload", PlayMode.StopAll);
    }
   
    {
    if(Input.GetKeyDown("ctrl"))
    animation.Play("Phrone", PlayMode.StopAll);
    }
   
    {
    if(Input.GetKeyDown("s"))
    animation.Play("ReverseWalk", PlayMode.StopAll);
    }
}

so if you can help me. thx

sorry for some dutch words. and the other animations is still in progress.

This would have been better to post on Unity Answers. If this is still a problem, all of your if statements are formatted incorrectly. Instead of:

  • {
  • if(Input.GetKeyDown(“your key”))
  • //Your code
  • }

It should be:

  • if(Input.GetKeyDown(“your key”))
  • {
  • //Your code
  • }