|
昨天遇到一个骨骼动画暂停的问题,没有解决,有位网友告诉了一个思路 今天做出来了 分享给大家!吼吼吼
void Start()
{
animation.Stop();
animation.wrapMode=WrapMode.Once;
}
void Update()
{
}
void OnGUI()
{
if(GUI.Button(new Rect(0,0,65,25),"Start"))
{
if(!animation.isPlaying)
{
Debug.Log(" start of playing");
animation["AnimationName"].speed=1;
animation.Play();
}
if(animation["AnimationName"].speed==0)
{
Debug.Log("start of stop");
animation["AnimationName"].speed=1;
animation.Play();
}
}
if(GUI.Button(new Rect(0,50,65,25),"Pause"))
{
if(animation.isPlaying)
{
Debug.Log("pause of playing");
}
else
{
Debug.Log("pause of stop");
}
animation["AnimationName"].speed=0;
}
}
|
|