- Home /
Check if an animation has played for a certain amount of time?
My game includes sword combat. A key mechanism is the parrying and blocking. I want to highlight this by making the animation more accurate when an attack is blocked or parried. I could just have one animation, but the way my game is played the sword contact can happen in various different places. With only one animation for getting blocked/parried, it looks very choppy and unnatural.
I don't if there is a better way to do this, but what I want to do is create several animations of being blocked or parried. And they will be played based on how long the attacking animation was played. Is that possible?
Any help would be much appreciated!
A simple (but probably not the best) solution would be to add a timer. If the animation is triggered save the startime like: var startedAnimation = Time.realtimeSinceStartup;
. When finished do: var animationDuration = Time.realtimeSinceStartup - startedAnimation;
Your answer
![](https://koobas.hobune.stream/wayback/20220612055437im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How to add keyframe animation to an imported FBX. 0 Answers
Animation at the end of the level 1 Answer