using UnityEngine;
using System.Collections;
public class AnimationsCount : MonoBehaviour {
Animation anim;
string[] animName;
// Use this for initialization
void Start () {
anim = this.gameObject.GetComponent<Animation>();
int a = anim.GetClipCount();
Debug.Log("----------------------------------动画的个数一共是:" + a);
int i = 0;
animName = new string[anim.GetClipCount()];
//Debug.Log("---这些动画的名字是:" + animName);
foreach (AnimationState state in anim)
{
animName[i++] = state.name;
Debug.Log(animName[i - 1]);
}
}
void GetAnimCountAndNum()
{
}
}
原文:http://www.cnblogs.com/ZeroMurder/p/5829176.html