The question is answered, right answer was accepted
I need to store the current time of an animator.
Answer by msiqueroli
Aug 26, 2015 at 01:18 PM
I found the solution:
Animator myAnimator = GameObject.Find("dadoAnimado").GetComponent<Animator>();
AnimatorStateInfo animationState = myAnimator.GetCurrentAnimatorStateInfo(0);
AnimatorClipInfo myAnimatorClip = myAnimator.GetCurrentAnimatorClipInfo(0);
float myTime = myAnimatorClip.clip.length * animationState.normalizedTime;
thank you. you saved my day!
Thanks for this mate!
Thanks, it worked!
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
30 People are following this question.
how to restart mecanim state animation or play it from random position [SOLVED]
Why is my animation being started, but is not actually playing?
How to play and hold on a single frame of an animator clip
How to make my Speed smooth an variable?
How can I use "animator.SetTrigger()" if "animator.SetBool()" has been true for X amount of seconds?