码迷,mamicode.com
首页 > 编程语言 > 详细

unity中遍历动画得到动画名字和动画数量

时间:2016-09-01 12:31:26      阅读:450      评论:0      收藏:0      [点我收藏+]

标签:

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()
{

}
}

unity中遍历动画得到动画名字和动画数量

标签:

原文地址:http://www.cnblogs.com/ZeroMurder/p/5829176.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!