Increase attack speed and animations

Hello,

I make a 2D beat’em up and I need your help for an issue I’m running about a gameplay feature.

The player have a skill which increase attack speed by 80%. So I have to do:

  • Increase attack speed by 80% which mean decreasing “attack duration” by 80%
  • Increase animation speed by 80%

I have a member variable called “attackDuration”.
In normal time, attackDuration = 1.5f. In normal time, my attack animation fit perfectly the attackDuration (animator.speed = 1.0f).

With the attack speed buff, the attackDuration fall to 0.3f. In the same time, I set the animator speed to 1.8f.
But for what I can see, my animation does not fit at all to my attack duration.

Is there a problem with animator.speed?
Someone running the same issue?

Thank you

EDIT: I logged the animation clip length:

  • Animator.speed = 1f => lenght = 1.5 sec
  • Animator.speed = 1.8f (+80%) => length = 0.8 sec

And for my attackduration:

  • Attackduration (normal time): 1.5 sec
  • Attackduration (+80% speed == multiplied by 0.2): 0.3 sec

It’s so sad to see that this question wasn’t answered for more than 5 years.
I have the same problem and I still have no idea how to solve it :frowning:
If I find a solution I’ll come back and write it here for future viewers !