I need a way to detect if animation's clip finished playing and then execute a certain code. Here's some script, that I wrote (called in Update):
if (Input.GetButtonDown ("Fire1") && pc_atttacking == false && PlayerStats.staminaCurrent != 0) {
pc_atttacking = true;
pc_anim.SetBool("attack", true);
}
if (pc_anim.GetCurrentAnimatorStateInfo (0).IsName ("attack")) {
pc_atttacking = false;
pc_anim.SetBool("attack", false);
}
But it doesn't work as I want; it executes second code too early - when "attack" animation is at slightly more than half of playing position. I want to execute it when "attack" animation is at last frame.
No comments:
Post a Comment