Animations only work at the begining

for my fighter script: the only way that I can get the animations to work is that I put the target.TakeDamage(weaponDamage); inside the previous function. when i add it to void hit the attack and animations wont play. With low health the enemy will die before i even strike them. anay idea? I have zero references to void hit() I added the public and it didnt help

private void AttackBehaviour()
        {
            if (timeSinceLastAttack > timeBetweenAttacks) 
            {
                // This will trigger the Hit() event.
                GetComponent<Animator>().SetTrigger("attack");
                timeSinceLastAttack = 0;
               target.TakeDamage(weaponDamage);
            }
        }

        // Animation Event
        public void Hit()
        {
            //target.TakeDamage(weaponDamage);
        }

Hit() gets triggered by the attack animation. There is a specific time on the attack timeline that triggers the hit, and that’s where we want the target to take damage. I have posted about it here:

You may want to check your animation to see that it is set up correctly

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms