just a quick question

hi guys, who is capable here of coding an instance wherein at the end of the attack animation the AI enemy spawns a single bullet each time the animation ends? Just 1 line of code will be of great help thanks!

edit: i tried ontriggerexit and event it doesn’t work for me

… what if it can’t be done in one line of code?

I suspect several people.

Of course I’m being the English teacher asking you if you meant “May I go to the bathroom?”, when you said “Can I go to the bathroom?”

You may want to look into animation events, or timing your actions with your animation controller, or honestly any number of techniques… but since I don’t know what you’re using to animate, I can’t really say with out more specifics.

1 Like

this is the code I’m using, I want the bullet to spawn when the attack animation ends but its not happening…the bullet fires nonstop and when I put a fireRate it wont fire bullets or it wont play attack anim…

    if (Vector2.Distance (transform.position, enemy.position) <= stoppingDistance ) {
                    anim.SetBool ("isAttacking", true);
                    Instantiate (bullet, transform.position, Quaternion.identity);