unity Animator 怎么判断一个动画播放结束

public class Crystal : MonoBehaviour {  

private Animator anim;  
// Use this for initialization  
void Start () {  

//play画  
anim = gameObject.GetComponent();  


}  

// Update is called once per frame  
void Update () {  
	AnimatorStateInfo animatorInfo;  
	animatorInfo = anim.GetCurrentAnimatorStateInfo (0);  //要在update获取
	if ((animatorInfo.normalizedTime > 1.0f) && (animatorInfo.IsName("MyPlay")))//normalizedTime:0-1在播放、0开始、1结束 MyPlay为状态机动画的名字
	{  
		//完成后的逻辑
	}  

		}  
}

你可能感兴趣的:(Unity)