I'm using C# and I'm currently building a 3rd person view game. I have a 3D character model with the animations in frames so I have to cut the animations by frame

The problem is I currently have 5 animations (idle, run, walk, punch, jump) and this is my code

```
void Update () {
    if (Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0){
        //play run animation
    } else {
        if (motion.x != 0 || motion.z != 0){
            motion.x = 0;
            motion.z = 0;
        }
                    //play idle anim
    }

    if (Input.GetKeyDown(KeyCode.Space) && controller.isGrounded){
    //play jump anim
    }

    if (Input.GetKeyDown(KeyCode.P)){
        //play punch anim
    }

    if (!controller.isGrounded){
        //play jump anim
    }

    vertVelo -= gravity * Time.deltaTime;
    motion.y = vertVelo;
    this.controller.Move(motion * Time.deltaTime);
}

```

The problem occurs when I press P to make the character punch. It seems the idle animation in the update function is being called so that the punch animation doesn't have time to play.

So, what's the solution? are there any animation managing technique or should I use delay?