用的是Animation的动画 所以动画Debug模式下的Legacy选项要勾上。
using UnityEngine;
using System.Collections;
public class Test : MonoBehaviour {
private Animation libai;
void Start () {
libai = gameObject.GetComponent ();
PlayAni ();
}
void PlayAni(){
libai ["test"].time = 0;
libai ["test"].speed = 1;
libai.Play ();
StartCoroutine ("PlayBack");
}
IEnumerator PlayBack(){
yield return new WaitForSeconds (2);
libai ["test"].time = libai ["test"].clip.length;
libai ["test"].speed = -1;
libai.Play ();
}
}
原创文章,作者:Y4er,未经授权禁止转载!如若转载,请联系作者:Y4er