- Home /
How to fix broken combo animation?
//attacks
if (Input.GetKeyDown(KeyCode.Mouse0) && comboIndex < comboParams.Length && stamina > 5) {
isAttacking = true;
anim.SetTrigger (comboParams [comboIndex]);
if (comboIndex > 1)
anim.ResetTrigger (comboParams [comboIndex - 1]);
//comboIndex++;
comboIndex = (comboIndex + 1) % comboParams.Length;
myStats.Fatigue (8);
resetTimer = 0f;
}
if (comboIndex > 0) {
resetTimer += Time.deltaTime;
}
if (resetTimer > fireRate) {
anim.SetTrigger ("Reset");
anim.ResetTrigger ("Attack1");
anim.ResetTrigger ("Attack2");
anim.ResetTrigger ("Attack3");
comboIndex = 0;
isAttacking = false;
}
i got this from a forum and when I tried it it worked great. however, while 'testing' the game and spamming the button, i realized that the triggers would sometimes stay active and the other animations wouldnt play. Heres how the animator is set.
![alt text][1]
The animation would often get stuck at the third stab animation whenever I spam the attack button. [1]: /storage/temp/114947-untitled.png
Answer by shadowpuppet · Apr 15, 2018 at 08:54 PM
are you getting any error messages? Not just pertaining to animation but ANY? I have come across similar situations where my animation wasn't working like it ought to and after beating my head against the wall trying to fix animations, I ended up just fixing some other error that popped up - totally unrelated to the animation - but caused the malfunction when it popped up at runtime
nothing. no error are co$$anonymous$$g up. after some research, i read that people often encounter this kind of problem with their animations when they use triggers. Im trying to figure out a solution to it myself.