Yesterday, my colleague wanted to control a character archery animation, in the bow when you want to use code to control the entire process of the character pulling the bow, check the API, the method is simple Animator.startplay () (Http://wiki.ceeger.com/script: Unityengine:classes:animator:animator.startplayback), use Animator.stopplayback () to stop the animation playback mode. Avatar restore control from game logic when playback is stopped
Example:
1 usingUnityengine;2 usingSystem.Collections;3 4 Public classAnimatorplay_ts:monobehaviour {5 6 PublicAnimator Animator; 7 8[Range (0,3)] 9 Public floatPlaybacktime =0;Ten One BOOLStartplayback =false; A - voidStart () { - animator. Startplayback (); theStartplayback =true; - - } - + } - voidUpdate () { + if(Startplayback) AAnimator.playbacktime =Playbacktime; at } -}
Unity3d Animator Control animations Run as frames