Auto attack animation won't stop after enemy is dead

Hi All,

I have an auto attack script that when it is in range and the enemy has been clicked it will attack that object till destroyed but when the object is destroyed the animation keeps playing.

i have tried a few different ways using if enemy current health is <= 0 do this or that but just can’t seem to get it working.

Would you be so kind and give me a few ideas on how to do this as i just can’t visualise it in my head?

Many Thanks

if the target has been destroyed it wont have a health value, it just wont exist…

how are you doing the animations? animator or legacy animations?

The animations are pre done i just pick the frames.

So i need to write something that will exit on the death of the object?
I will go and have a look at that to see what i can do but any ideas would be great?

Thanks for your response :slight_smile: