Untity 5.x animation length script access

Hey Community,

I have some troubles with the Unity version again. But first the explanation what I am actually trying to do.

I created an attack animation and also a health variable for a mob. The attack animation is a little bit long and I want reduce the health of the mob, if the “dagger” for example is directly in front of the mob. To do that I thought to access the length of the animation and reduce the mob health if the animation is at frame 24 for example, where the “dagger” hits the mob.

In Unity 4.x it was like animation(attack.name).length

Currently my animation is declared followed:

Animation attack;
..
attack = GetComponent<Animation>();
attack.CrossFade("attack");
..

How can I access the length of this animation. attack.length doesn´t work at all :frowning:

Regards

Pharmi

Ok I found the solution by myself. Its attack.clip.length for now.