Search Unity

Question The relationship between the attacking animation and attack speed

Discussion in 'Animation' started by mugewara, May 26, 2020.

  1. mugewara


    Feb 13, 2018
    Hello. I'm new here, and I gotta say, I'm loving it here, it's a great community. This is my first time posting here so please be patient with me.

    So, the problem is that I have an RPG-like game with units that have attack speed stat, how can I make the attacking sync exactly as the attack animation while being accurate to the attack speed? These are the things that I'm thinking of:

    • I could use animation events and adjust the animation speed based on the attack speed, but this introduces a problem if the animations have different frames/framerates. X and Y units could have 1.0 attack speed, but X unit attack once per second while Y unit attacks once per 0.7 seconds.
    • I could use animation events and adjusting the animation speed, BUT only use animations that have the same frame count/rate, but this feels wrong and tiring.
    • I could use two animations at the same time, the wind-up animation and the attack animation, and immediately play the attack animation once the unit is ready to attack while adjusting the speed of the wind-up animation. This could be the best solution, but it is the most complex.
    Any thoughts?
    Last edited: May 27, 2020
    Artyomkek likes this.