I want to know the current time of the played animation using script in Unity3d. I tried using
currentState.normalizedTime but this time is not the time of the animation, like it's the time of the runtime I think. Any advice please?
You would use AnimationState.time
It can be larger than the length of the animation, so to get the value with this, you would need to modulo with the animation clip length.
float time = currentState.time % currentState.clip.length;
You can also use Normalized Time, but you would have to mulitply the value by the length instead of the animation (AnimationClip.Length)
float time = currentState.normalizedTime * currentState.clip.length;