unity 动画插件 Animancer
去asset store下个Animancer Lite给角色挂个Animancer Component,Animator选自己
创建个脚本控制动作切换,对比unity自带的Animator Control这个动作切换就不会有间隔。
public class TestAnimancer : MonoBehaviour
{
public AnimancerComponent _Animancer;
public AnimationClip _Idle;
public AnimationClip _Action;
bool b;
private void Start()
{
b = true;
}
private void OnEnable()
{
_Animancer.Play(_Idle);
}
private void Update()
{
if (Input.GetMouseButtonDown(0))
{
if (b)
{
var state = _Animancer.Play(_Action);
//state.Events.OnEnd = OnActionEnd; //动画播放完后回调函数
}
else
{
_Animancer.Play(_Idle);
}
b = !b;
}
}
private void OnActionEnd()
{
_Animancer.Play(_Idle, 0.25f);
}
}
页:
[1]