Timeline for Get the current time of animation using script Unity3d
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 27, 2015 at 16:48 | comment | added | Tak |
and this is the declaration of currentState : AnimatorStateInfo currentState = my_Animator.GetCurrentAnimatorStateInfo(0);
|
|
Jul 27, 2015 at 16:47 | comment | added | Tak |
it is still not working as it gives this error Error CS1061: 'UnityEngine.AnimatorStateInfo' does not contain a definition for 'time' and no extension method 'time' accepting a first argument of type 'UnityEngine.AnimatorStateInfo' could be found (are you missing a using directive or an assembly reference?) (CS1061) (Assembly-CSharp)
|
|
Jul 27, 2015 at 16:45 | history | edited | jgallant | CC BY-SA 3.0 |
added 12 characters in body
|
Jul 27, 2015 at 16:44 | comment | added | jgallant | You have to reference the actual animation instance. Use currentState.clip.length; | |
Jul 27, 2015 at 16:43 | comment | added | Tak |
I tried it and it gives this error Error CS0117: 'UnityEngine.Animation' does not contain a definition for 'length' (CS0117) (Assembly-CSharp)
|
|
Jul 27, 2015 at 16:28 | comment | added | jgallant | Sorry, I was still editing the question after I posted it. | |
Jul 27, 2015 at 16:26 | history | edited | jgallant | CC BY-SA 3.0 |
added 215 characters in body
|
Jul 27, 2015 at 16:26 | comment | added | Tak | But this is the animation time or the run time? Like what if after running my application I didn't play the animation until 5 seconds, would these 5 seconds included when using AnimationState.Time? | |
Jul 27, 2015 at 16:24 | history | answered | jgallant | CC BY-SA 3.0 |